Set Image source programmatically

I am working on a use case, where I have to set image source programmatically based on an input value. Eg: When I have a value of 'House1' in a form field, I have to display House1.png picture from a folder in file system. How can I do this?

Thanks Timo.
JDev Ver: 11.1.2.3
I used the easy solution to have the images in a sub directory under root and accessing them using EL language. It is working fine. I have another question, as to the process to be implemented if I have to update the images. The application that I am working on has a need to update the images frequently. What is the best way to do it? I am thinking of creating a jar file for images and deploying it to web logic server Ishared library). If I have to add a new image, I can just make a jar file and re-deploy it again. I am new to ADF, so I am not sure if my approach is correct. Please advise.
And, thanks for your blog. It was helpful.
-Ashok

Similar Messages

  • How to set image source path in formsweb.cfg file in forms 11g

    Hi,
    I had written HTML code in the formsweb.cfg file in forms 11g. In the below code i am unable to retrive image file(i.e., .gif, .jpeg) from the server or local machine.
    In the below HTML code i set image source in the image tag as below:
    <img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_04.GIF"
    Is this correct path to fetch the images from the server or local machine .
    Please help me out how to set path for image in html or is there any alternate process to retrive images.
    Here is the code :
    [INDIVIDUALUAT]
    workingDirectory=D:\Aims10dev\Work
    form=LMstartup.fmx
    userid=rmenu/rmenu@RLIFEQA64
    codebase=/forms/java
    imageBase=codebase
    width=1005
    height=750
    WebUtilArchive=/forms/java/frmwebutil.jar,/forms/webutil/jacob.jar
    WebUtilLogging=off
    WebUtilLoggingDetail=normal
    WebUtilErrorMode=Alert
    WebUtilDispatchMonitorInterval=5
    WebUtilTrustInternal=true
    WebUtilMaxTransferSize=16384
    baseHTMLjinitiator=webutiljini.htm
    baseHTMLjpi=webutiljpi.htm
    archive_jini=frmall_jinit.jar,life-icons-round.jar,Agilis_Icon.jar,life_Icon.jar,personalize.jar,hyperlink.jar,amazingbutton.jar
    archive=frmall.jar
    separateFrame=False
    lookandfeel=Generic
    EndUserMonitoringURL=True
    usesdi=yes
    #HTMLbeforeForm= <table width="1005" border="0" cellspacing="0" cellpadding="0"><tr><td width="200"><img src="/forms/html/agilis-life-logo.gif" width="200" height="80" /></td><td width="10"><img src="/forms/html/agilis-life-new11_02.gif" width="36" height="80" /></td><td width="805" valign="top" background="/forms/html/agilis-life-new11_03.gif"></td></tr></td></tr></table>
    HTMLbeforeForm=<body topmargin="0" leftmargin="0" > <table width="1005" height="100" border="0" cellspacing="0" cellpadding="0"><tr><td width="200" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-logo.gif" width="200" height="80" /></td><td width="10" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_02.gif" width="36" height="80" /></td><td width="550" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_03.gif" width="550" height="80" /></td><td valign="bottom"><table width="219" height="90" border="0" cellspacing="0" cellpadding="0"><tr><td height="36" valign="bottom" align="center"><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agile-logo.jpg" height="36"></td></tr><tr><td height="10" valign="bottom"> <div align="right"><span style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; text-decoration:none; color:#00000; " >Home | Change Password | Logout</span></div></td></tr><tr><td colspan="3" valign="bottom"><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_04.GIF" width="100%" height="39" /></td></tr></table></td></tr></td></tr></table></body>

    AFAIK, this is not the correct way to set the image location.
    We call the working directory as context, so inside the context root along with WEB-INF, maintain a folder with name img and put all the images in that directory.
    You can use either .\<image_folder> or the optimum way would be (if you are using JSPs) to use getContext() method and traverse accordingly.
    FYI,,, using getContext() will give you context root directory, from there it is as simple as accessing any other folder.
    Hope this answers your question.
    Cheers,
    Jeets.

  • Changing Image Source programmatically

    Hi
    I've got a problem changing my image source based on a value in a variable.
    The following function gets kicked off, but I get a TypeError: Error #1009: Cannot access a property or method of a null object reference. error.
    I've tried embedding, and the solution you see below (which i found here - as I am chaning it at run time http://forums.adobe.com/message/116979#116979), but no luck
    I am certain its how I'm mapping the png, but I can't be sure..... any suggestions?  I've been banging my head against my desk for ages on this!
    function (note - the trace proves that the value to change the image is correct)
    public function LeversComplete():void{
        if(PodContentBase._ProjectDetail.getItemAt(0).IndustryLeadingMastery == "N")
              trace("Value" + PodContentBase._ProjectDetail.getItemAt(0).IndustryLeadingMastery)
                imgIndustry.source = "/assets/bigcheese.png";
         else {imgIndustry.source = "assets/Nocheese.png"} 
    Image (note - this is set as a defualt - and defaults in fine)
           <mx:Image id="imgIndustryleadingtechnicalmastery"
                                  source="assets/bigcheese.png"/>
    Picture of Directory Structure:

    Hi - all done - dead right - The image didnt exisit and i'm trying to stuff things in it - what a divvy -
    Anyways, this worked -    I check if the image exists before I try and change it.            
    public function LeversComplete():void{
              if (imgIndustryleadingtechnicalmastery){
                   if(PodContentBase._ProjectDetail.getItemAt(0).IndustryLeadingMastery == "N") {imgIndustryleadingtechnicalmastery.source="assets/nocheese.png"}
                   else {imgIndustryleadingtechnicalmastery.source = "assets/bigcheese.png"} 

  • Create a trigger which set Image source with binding to a dependency property.

    I'm trying to create a specified button which switch images every time it pressed, without using the Click CBFunction, so I'm using toggle button and triggers (checked unchecked) and I want this button to
    supply DP of string so who ever uses is button will only have to specify the images paths and a click CBFuntion to
    perform what ever he wishes.
    I managed to create the mechanism for switching images with triggers(but the triggers image paths are hard coded and not using DP) and to enable setting a click CBFunction. When I switch the hard coded image path with a DP which return a string with
    the path the program crush, an exception is thrown.
    U.C xaml:
    <UserControl x:Class="ButtonChangeImage.UserControl1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    mc:Ignorable="d">
    <Grid>
    <ToggleButton x:Name="btnCI">
    <ToggleButton.Content >
    <Image Name="img" Source="C:\Users\AmitL\Desktop\joecocker.jpg"/>
    </ToggleButton.Content>
    <ToggleButton.Triggers>
    <EventTrigger RoutedEvent="ToggleButton.Checked">
    <EventTrigger.Actions>
    <BeginStoryboard>
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.Target="{x:Reference img}" Storyboard.TargetProperty="Source">
    <DiscreteObjectKeyFrame KeyTime="0:0:0">
    <DiscreteObjectKeyFrame.Value>
    <BitmapImage UriSource="{Binding FirstImage}"/>
    <!--<BitmapImage UriSource="C:\Users\AmitL\Desktop\james-brown-010.jpg"/>--><!--if I switch to this line it works fine!-->
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </BeginStoryboard>
    </EventTrigger.Actions>
    </EventTrigger>
    <EventTrigger RoutedEvent="ToggleButton.Unchecked">
    <EventTrigger.Actions>
    <BeginStoryboard>
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.Target="{x:Reference img}" Storyboard.TargetProperty="Source">
    <DiscreteObjectKeyFrame KeyTime="0:0:0">
    <DiscreteObjectKeyFrame.Value>
    <BitmapImage UriSource="C:\Users\AmitL\Desktop\joecocker.jpg"/>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </BeginStoryboard>
    </EventTrigger.Actions>
    </EventTrigger>
    </ToggleButton.Triggers>
    </ToggleButton>
    </Grid>
    </UserControl>
    U.C cs:
    public partial class UserControl1 : UserControl
    public static readonly DependencyProperty FirstImageDP = DependencyProperty.Register("FirstImage", typeof(string), typeof(UserControl1), new PropertyMetadata(@"C:\Users\AmitL\Desktop\james-brown-010.jpg", new PropertyChangedCallback(FirstImageSource)));
    private string m_strFirstImage = string.Empty;
    private BitmapImage m_oBMImage = null;
    private static void FirstImageSource(DependencyObject obj, DependencyPropertyChangedEventArgs args)
    UserControl1 l_UCBtnSwitchImage = (UserControl1)obj;
    l_UCBtnSwitchImage.m_strFirstImage = (string)args.NewValue;
    l_UCBtnSwitchImage.m_oBMImage = new BitmapImage(new Uri(l_UCBtnSwitchImage.m_strFirstImage, UriKind.Absolute));
    public string FirstImage
    get
    string l_strTemp = (string)GetValue(FirstImageDP);
    return l_strTemp;
    set
    SetValue(FirstImageDP, value);
    public event RoutedEventHandler Click
    add { btnCI.Click += value; }
    remove { btnCI.Click -= value; }
    public UserControl1()
    InitializeComponent();
    window xaml:
    <Window x:Class="ButtonChangeImage.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:m="clr-namespace:ButtonChangeImage"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <m:UserControl1 Click="ToggleButton_Checked" FirstImage="C:\Users\AmitL\Desktop\james-brown-010.jpg"></m:UserControl1>
    </Grid>
    </Window>
    The exception:
    A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
    Additional information: 'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '20' and line position '46'.
    I would love to know why when I switch the hard coded value with DP it suddenly throw exception, how to fix it or if there is other way to achieve U.C with those demands.
    Thanks.

    Hey Magnus,
    Unfortunately I get the same result, the button is switching between the (Joe Cocker) image to blue button(normal pressed button look) how come the
    (Joe Cocker) image return I didn't set a trigger for unchecked so what make it change the content
    or the image source back to that image?
    And I can't debug (by the way what's happening there how come it doesn't stop in all those code lines?).
    I didn't make any changes here is all the code:
    U.C cs:
    namespace ButtonChangeImage
    public class ImageConverter : IValueConverter
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    string s = value as string;
    var source = new System.Windows.Media.Imaging.BitmapImage();
    source.BeginInit();
    source.UriSource = new Uri(s, UriKind.RelativeOrAbsolute);
    source.EndInit();
    return source;
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    throw new NotImplementedException();
    public partial class UserControl1 : UserControl
    public static readonly DependencyProperty FirstImageDP = DependencyProperty.Register("FirstImage", typeof(string), typeof(UserControl1), new PropertyMetadata(@"C:\Users\AmitL\Desktop\james-brown-010.jpg", new PropertyChangedCallback(FirstImageSource)));
    private string m_strFirstImage = string.Empty;
    private BitmapImage m_oBMImage = null;
    private static void FirstImageSource(DependencyObject obj, DependencyPropertyChangedEventArgs args)
    UserControl1 l_UCBtnSwitchImage = (UserControl1)obj;
    l_UCBtnSwitchImage.m_strFirstImage = (string)args.NewValue;
    l_UCBtnSwitchImage.m_oBMImage = new BitmapImage(new Uri(l_UCBtnSwitchImage.m_strFirstImage, UriKind.Absolute));
    public string FirstImage
    get
    string l_strTemp = (string)GetValue(FirstImageDP);
    return l_strTemp;
    set
    SetValue(FirstImageDP, value);
    public event RoutedEventHandler Click
    add { btnCI.Click += value; }
    remove { btnCI.Click -= value; }
    public UserControl1()
    InitializeComponent();
    U.C xaml:
    <UserControl x:Class="ButtonChangeImage.UserControl1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    mc:Ignorable="d">
    <Grid>
    <ToggleButton x:Name="btnCI" xmlns:local="clr-namespace:ButtonChangeImage">
    <ToggleButton.Resources>
    <local:ImageConverter x:Key="conv" />
    </ToggleButton.Resources>
    <ToggleButton.Style>
    <Style TargetType="ToggleButton">
    <Setter Property="Content">
    <Setter.Value>
    <Image Name="img" Source="C:\Users\AmitL\Desktop\joecocker.jpg"/>
    </Setter.Value>
    </Setter>
    <Style.Triggers>
    <Trigger Property="IsChecked" Value="True">
    <Setter Property="Content">
    <Setter.Value>
    <Image Source="{Binding Path=FirstImage, Converter={StaticResource conv}}"/>
    </Setter.Value>
    </Setter>
    </Trigger>
    </Style.Triggers>
    </Style>
    </ToggleButton.Style>
    </ToggleButton>
    </Grid>
    </UserControl>
    Main Window cs:
    namespace ButtonChangeImage
    public partial class MainWindow : Window
    public MainWindow()
    InitializeComponent();
    private void ToggleButton_Checked(object sender, RoutedEventArgs e)
    MessageBox.Show("f");
    Main Window xaml:
    <Window x:Class="ButtonChangeImage.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:m="clr-namespace:ButtonChangeImage"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <m:UserControl1 Click="ToggleButton_Checked" FirstImage="C:\Users\AmitL\Desktop\james-brown-010.jpg"></m:UserControl1>
    </Grid>
    </Window>
    Thanks,
    Amit.

  • Using Ternary operators to set image source

    Hi,
    I'm using JDeveloper llg, and have an ADF table, in one of the columns im trying to have just an image displayed.
    Using:
              <af:column width="16">
                         <img src="icons/bullet_green.png"
                                 height="16"
                                 width="16"/>
                </af:column>this works fine and the correct image is displayed. Is it possible to use an EL expression to determine which image should be displayed using a ternary operator? i have tried the following:
              <af:column width="16">
                            <img src="#{row.ServiceState == '100' ? 'icons/bullet_green.png' : 'icons/bullet_red.png'}"
                                 height="16"
                                 width="16"/>
              </af:column>however no image at all is now displayed when the application is run. Does anybody now how to fix this?
    Thanks in advance...

    One solution is to use an af:image instead of the normal img tag. Then put two af:image tags inside you af:column and set the visible attribute to your EL like:
    <af:column width="16">
    <af:image shortDesc="klassiert" source="icons/bullet_green.png" visible="#{row.ServiceState == '100'}" inlineStyle=" height:16px; width:16px;" />
    <af:image shortDesc="klassiert" source="icons/bullet_red.png" visible="#{row.ServiceState != '100'}" inlineStyle=" height:16px; width:16px;" />
    </af:column>Timo

  • How set Image Source with C#

    Hi,
    In C# I use FileOpenPicker to select the test.jpg, But it can't display the test.jpg.
    1. C#
    private async void button_addImage_Click(object sender, RoutedEventArgs e)
    FileOpenPicker fileOpenPicker = new FileOpenPicker();
    //fileOpenPicker.ViewMode = PickerViewMode.List;
    fileOpenPicker.ViewMode = PickerViewMode.Thumbnail;
    fileOpenPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
    fileOpenPicker.FileTypeFilter.Add(".jpg");
    fileOpenPicker.FileTypeFilter.Add(".jpeg");
    fileOpenPicker.FileTypeFilter.Add(".png");
    StorageFile file = await fileOpenPicker.PickSingleFileAsync();
    if (file != null)
    Uri uri = new Uri(file.Path, UriKind.RelativeOrAbsolute);
    image_show.Source = new BitmapImage(uri);
    button_addImage.Visibility = Visibility.Collapsed;
    2. XAML
    <Grid Background="Orange" VerticalAlignment="Stretch">
    <!-- Source="ms-appx:///Assets/test.jpg" this is OK -->
    <Image x:Name="image_show" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Stretch="Uniform"/> <Button x:Name="button_addImage" Content="+" Click="button_addImage_Click">
    </Grid>

    Your app doesn't have access to the path the user picked. It needs to use the StorageFile returned from PickSingleFileAsync rather than bypassing it and going directly to the path. I discuss this in more detail in my blog entry at
    http://blogs.msdn.com/b/wsdevsol/archive/2012/12/05/stray-from-the-path-stick-to-the-storagefile.aspx .
    Open the StorageFile with StorageFile.OpenAsync then pass that stream to
    BitmapImage.SetSourceAsync. See the code snippet in the docs for an example.

  • Setting 'source' of Image component programmatically

    How do you change the source of an mx:Image component
    programmatically in ActionScript?
    I have an image like this:
    <mx:Image id="myImage"
    source="@Embed(source='image1.png')" />
    Then I want to change this in my actionscript to image2.png.
    Why does not the following code work?
    myImage.source = "@Embed(source='image1.png')";
    The image won't load, it just displays a small square icon. I
    am sure that the path is correct because it works when I use the
    Embed statement in the component declaration.
    I appreciate your help!

    The line:
    <mx:Image id="myImage"
    source="@Embed(source='image1.png')" />
    embeds the image into your SWF file at compile time. To
    change the source at run time, you'll try something like:
    myImage.source = "images/image1.png";
    Where images is your folder on the root of web application
    context you're in and image1.png is the image to be loaded.
    Here is from image class help from docs:
    The URL, object, class or string name of a class to load as
    the content. The source property takes the following form:
    source="URLOrPathOrClass"
    source="@Embed(source='PathOrClass')"
    ATTA

  • How to set the source property of image control dynamically?

    Hi,
      I have different fxg files which I want to display in a list. For each row in the List, I define which fxg file to be displayed in my database.
    I need to know how to set the image1.source = (the fxg path) as a string from database?
    Is there any conversion needed in this case? If so, can you please help me how to do this?

    Hi,
      Thank you for your response. I am new to Adobe Flash Builder, Flex and action script. I don't get your answer straight away.
    What I basically need is, I need to set image1.source = strFXG. Right now, this does not show the image. I don't understand fxgObject.pathid.source => how to give this?
    Moreover, when I did google search, there is somethink like fxg converter which converts the fxg to a component. I thought this is a very simple problem on how to convert the fxg string to an object format. But now, it looks like it might be a big problem. Can anyone help me in this?
    import spark.components.Image;
                                  protected function view1_creationCompleteHandler(event:FlexEvent):void
      // TODO Auto-generated method stub
      var strFXG:String = 'assets.DB_Actief_Graphics';
                                            var image1:Image = new Image();
                                            image1.x = 100;
                                            image1.y = 100;
                                            image1.source = strFXG;
                                            addElement(image1);
    Regards,
    Chella

  • Setting Image control source to image in IsolatedStorage.

    Hi. I capture an Image and save it to IsolatedStorage. What's the URI (source for Image control) for IsolatedStorage to automatically display that image if it's available in IsolatedStorage? Thank you in advance.

    Try this code to retrieve the image from isoStore.
    It works for me.
    using (IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication())
    if (iso.FileExists(string.Format("image.png")))
    string fileName = "image.png";
    string filePath = iso.GetType().GetField("m_RootDir", System.Reflection.BindingFlags.NonPublic |
    System.Reflection.BindingFlags.Instance).GetValue(iso).ToString() + fileName;
    You can set the source of the Image to filePath and you won't have any problem accessing it.
    If this doesnt work, then the problem is while you are saving the image. You might have to find a workaround for saving the canvas to png or jpeg.
    If my reply answers your question, please mark this post as answered.

  • Set image src within a symbol - How?

    I have created a symbol in Edge Animate, which contains a rectangle as view area and an image and text as contents of that view area. I want to set text and image src before I start the animation of the symbol. I can set "Text" with
    var thing = sym.getSymbol("mySymbol");thing.$("Text").html("I can set some text here to change the content of Text.");
    and when I start the animation of that symbol, the new text is used. Question now is, how I can set the image source for the item "Image" within that symbol. I have looked into the files Edge Animate creates, and the text as shown above is in a field called "text", while the name of the image is contained with other information in a field called "fill". I don't have a clue how to set the image source. Any pointers?
    I don't want to create 24 instances of something for an advent calender, I just want to have one, which I fill through JavaScript, before the animation is shown. All text and all images have almost the same size, so this should be doable somehow.
    The follow on question would be, whether the preloader loads all 24 images, because they are not actually referenced in any EA object...
    Thanks in advance!

    This tutorial (with sample file) should assist with what you are attempting to accomplish.
    http://www.gotoandlearn.com/play.php?id=168
    hth
    Darrell

  • Have to toggle "Relative to" button each time I try to change an image source

    Dreamweaver CS4 running on Windows 7. 
    When changing an existing image on an existing web page in Dreamweaver by double-clicking the existing image on the page to open the Select Image Source panel, I have to toggle the "Relative to" (Site Root / Document) button for each image.
    In other words, say that when using Design view, I want to replace img1.jpg with img3.jpg, and IMG2.jpg with img4.jpg,   The steps I have to take are:
    1. Double click img1.jpg on the page to open the Select Image Source panel.
    2. Select img3.jpg. 
    3. Click the Relative to button at the bottom of the panel and change it from whichever it is on (Site Root, let's say) to the other option (Document).
    4, Then click OK.
    5. Double click img2.jpg on the page...
    6. Select img4.jpg
    7 Select the other option (SIte Root) in the Relative to drop down
    8. Then click OK
    9. Repeat for each image whose source is being changed.  If one is relative to Site Root, the next will have to be relative to Document, then the next again I have to select Site Root, etc.
    If I don't select the other relative to option, the image source path will not change when I click OK.
    Default Link Relative To in site definition is set to Document.
    It's been like this for weeks now and it's starting to get annoying.  Any ideas?

    David, I tried deleting the corrupt cache flie, no difference.  Deleted the config folder, same.  Other than I lost the extensions... and had to reinstall them.
    However, John's answer is correct.  And clicking another image before clicking the one I want is faster than the way I was doing it.
    It makes no difference if they are .png .jpg or .gif images.
    By the way, I was wrong about my DW version.  Turns out it's CS3.  Guess it's time to upgrade... one of thes days!
    Thanks everyone!
    Message was edited by: tarfh, to add sentence about png images.

  • Use different "fx-border-image-source" for first tab and remaining tabs

    Hi,
    I'm using something like this
    .tab {
    -fx-padding: 0px 5px -2px 5px;
    -fx-background-insets: 0 -20 0 0;
    -fx-background-color: transparent;
    -fx-text-fill: #c4d8de;
    -fx-border-image-source: url("images/tab5.png");
    -fx-border-image-slice: 20 20 20 20 fill;
    -fx-border-image-width: 20 20 20 20;
    -fx-border-image-repeat: stretch;
    -fx-font-size: 22px;
    .tab:selected {
    -fx-border-image-source: url("images/tab-selected5.png");
    -fx-text-fill: #333333;
         -fx-background-color: red;*/
    to customize the tab appearance of a TabPane.
    That worked well. But I need to use a different set of images for just the first tab. Does anyone know a way to accomplish that?
    Thanks.

    How can I "fix up" the first tab of tab panes that are created after I "fixed up" the first tab of the initial tab pane?
    My app allows user to create new tab panes at any moment during program execution.Not easy to answer this one.
    The best answer would be to use structural pseudoclasses, but (as David points out), they are not yet implemented.
    The trick here is how to identify the first tab of each tab pane so that it can be styled separately from the other panes.
    Doing the styling without a dynamic lookup is preferrable to using a dynamic lookup (i.e. when the first tab is created give it a specific style, e.g. tab0).
    This is how the charts work, where they set style classes based on series of data, e.g. series0, series1 - this allows you to independently style each series of data.
    However the chart stuff has all of that built into the implementation, whereas the tabs don't. To achieve that you would likely need to go into the TabSkin code (http://openjdk.java.net/projects/openjfx/) find out where and how it generates the Tab nodes and write a custom tab skin or extension of the existing one which assigns a numeric style class to each new tab in a pane (e.g tab0, tab1, etc). In other words, not particularly easy if you are unfamilar with the tab skin implementation. You could log a javafx jira feature request to have those style classes set on tabs - file it here => http://javafx-jira.kenai.com.
    In the meantime a simple alternative is to use the dynamic lookup method in my previous post and a hack such that whenever you add a new tab pane to the scene you do something like the following:
    new Timeline(
      new KeyFrame(
        Duration.millis(50),
        new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent arg0) {
            Node tab = newTabPane.lookup(".tab");
            if (tab != null) tab.getStyleClass().add("first-tab");
    ).play();The reason for the Timeline is that I don't really know at what stage the css layout pass is executed. I know that when you initially show the stage and then do a lookup, the css pass seems to have already been done and the lookup will work. But for something that is dynamically added or modified after the scene is displayed - I have no idea when the css layout pass occurs, other than it's some time in the future and not at the time that you add the tabPane to the scene. So, the Timeline introduces a short delay to (hopefully) give the css layout pass time to execute and allow the lookup to work (not return null). Not the best or most efficient solution, but should work for you.

  • Image.source in ItemRenderer works in Windows but not Mac

    I have a Flex (AIR) application that is giving me problems on
    the Mac. In one of the
    Datagrids, I am using an ItemRenderer with an image control.
    Some code in the
    "set data(value:Object)" function assigns a file path as the
    source of the image
    control as follows.
    imgThumb.source =
    File.documentsDirectory.resolvePath("pdqtemp").nativePath +
    "/" + data.strJPGFileName;
    This works correctly in Windows , but not on the Mac.
    In this case, the path resolves to the following on the Mac.
    /Users/brian/Documents/pdqtemp/artist_01t.jpg
    I have verified that the file is in the right place and when
    using the path in
    the command line console, it correctly addresses that
    directory and file. I
    don't normally develop apps for the Mac so I am sure there is
    something I am
    missing.
    Any ideas?
    Thanks for your help.

    Hi Jed,
    Thanks for responding
    That is the exact path assigned to the Source of the Image
    control. However, it isn't exactly a trace of the Image.Source
    property.
    The code in question is attached
    The alert shows the path I originally posted and shows that
    the fileImgThumb.exists returns False.
    As I mentioned, this works perfectly in Windows. There is
    some code elsewhere in the app that creates the thumbnail. That
    does work on the Mac as the thumbnail image is created and saved
    where expected.
    I am not sure what I might be doing wrong.
    Thanks for your help,
    Sid

  • Conditional image and image source in SSRS

    I have images stored in database for some of the items but not for the others. If there is no image in the database I would like to display static placeholder image embedded in the report.
    Is there a way to achieve that? The problem I experience is that there is no way to specify expression for Image Source. I tried to use expressions for Value field (when Image Source is set to Database) to specify the name for embedded image depending on
    condition but nothing I tried worked.

    If your image is embedded in a tablix then, yes, you are sourced to a single dataset. However the Lookup function pulls in "related" data from another dataset. Related is in quotes because there are ways to fool it. The syntax is:
    =Lookup(index_current_dataset, index_other_dataset,field_to_get_from_other_dataset, other_dataset_name)
    If you have a second dataset, "Second", that returns a single column, "Picture", that is your default image, you can retrieve that image using lookupset as follows:
    =Lookup(1,1,Fields!Picture.Value,"Second")
    the 1,1 is used to fool the lookup expression. Since 1 will always match 1, it will return everything in the dataset, which is the single image. Throw that into a logical check (IIf) and you get:
    =IIf(IsNothing(Fields!RelatedImage.Value), Lookup(1,1,Fields!Picture.Value,"Second"), Fields!RelatedImage.Value)
    That said Andre's approach should work also. the example may be for embedded but the principle should work for db as well since you can set a formula for visibility. Yours is in a tablix so it will require some tweaks.
    In the cell where the image will be embedded, first add a rectangle. The rectangle will allow you to add 2 images to the cell. Add your default image and set its source to whatever you like. It can even be an embedded image. Now add a second image and set
    it to your database image field. In the visibility property of each image set it show or hide based on an expression:
    default image expression: =IIf(IsNothing(Fields!Image.Value),false,true)
    db image expression: =IIf(IsNothing(Fields!Image.Value),true,false)
    You will want to set the cell width/height so it is equal or smaller than 1 image in design view. A table cell can grow bigger at runtime to accommodate more content but not smaller. Because of this, you need to set the design-time cell height and width
    equal or smaller than a single image.
    The advantage of this approach is that the default image does not need to come from a dataset like with my suggestion.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • Don't Cache Image Source URI?

    Is it possible to set an image source to a URI without the app caching the image to disk?  I am streaming a JPEG file that is rewritten every 40ms and I want to refresh the image source to playback like a video but it's only loading the image once
    and never refreshing it. 
    Thanks,
    Gavin
    EDIT I should note that this is my code. I am using the IgnoreImageCache option but it's not doing aything:
    BitmapImage bmp = new BitmapImage(new Uri("http://192.168.94.53/image.jpeg"));
    bmp.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
    IMAGE.Source = bmp;
    Also tried this and it didn't work:
    IMAGE.Source = null;
    BitmapImage bmp = new BitmapImage();
    bmp.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
    bmp.UriSource = new Uri("http://192.168.94.53/image.jpeg");
    IMAGE.Source = bmp;

    Hi im.thatoneguy,
    Try this:
    private void Button_Click(object sender, RoutedEventArgs e)
    image.Source = null;
    BitmapImage bmp = new BitmapImage();
    bmp.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
    bmp.UriSource = new Uri(@"http://10.168.196.118/iis-85.png?" + DateTime.Now);
    image.Source = bmp;
    Tested locally, works fine, adding timespan as GET request can help to refresh.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • After wakeup from pc sleep I cant start any application

    I upgraded archlinux to newes kernel, pacman, software and after upgrade when I put my laptop to sleep mode(covering lid), when it wakes up, I cant start any application. Allways I have to mannualy restart pc and then it works. I have fluxbox. What c

  • HT2905 How to show duplicates in iTunes 11?

    there is no "show duplicates" in iTunes 11 file menu how to find duplicates?

  • Setting Default Views of Mounted Server Shares

    In OS X 10.5 server, how do I change the owner of a volume? So I can do the stuff below? Do I change the owner in the Finder...? Or do you use the OS X Server admin utility type programs? Thanks Re: Setting Default Views of Mounted Server Shares Post

  • Hi Expert, Using DI -Server configuration Problem in Web-base application

    Hi Expert, I am creating Web-base application using ASP.net. Scenario 1- Machine A i installed SAP B1 + DI-SERVER Service Manager IIS SERVER + B1WS On This machine my application working fine. Scenario 2- Machine A i installed DI-SERVER + IIS SERVER

  • Spry UI Image Slideshow

    I'm pretty new to Dreamweaver and by no means and expert in web design and no nothing about writing HTML code.  I have downloaded the Spry UI Image Slideshow to use on a web.  I have figured out how to make my picture available by replacing the ones