Changing TextField color / backgroundColor Dynamically?

Is it possible to change the color or background color of a textfield using actionscript in a MXML file???  A simple example:
<fx:Script>
     <![CDATA[
          var changeColor:Boolean = true;
          if (changeColor == true)
               exampleText.color = '#FF000';
               exampleText.backgroundColor = '#FFFFFF';
     ]]>
</fx:Script>
<s:TextInput id="exampleText" text="Example Text" />
Neither seems to work!?!?!

@Lax - is your question answered?
UPDATE: Just noticed you are using contentBackgroundColor (was looking at the post title).
Use contentBackgroundColor and contentBackgroundAlpha.
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark" title="Home">
    <fx:Script>
        <![CDATA[
            protected function textinput1_clickHandler(event:MouseEvent):void {
                event.currentTarget.setStyle("color", "#0000ff");
                event.currentTarget.setStyle("contentBackgroundColor", 0x00ff00);
        ]]>
    </fx:Script>
    <s:TextInput contentBackgroundColor="#666666" text="Hello color filled World" click="textinput1_clickHandler(event)"/>
</s:View>
FYI keep in mind you now have access to the FXG MXML markup. This can be a quicker solution than recreating a new skin. If the contentBackgroundColor property didn't exist this is what you could have done prior to creating your own skin:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark" title="Home"
    <fx:Script>
        <![CDATA[
            protected function textinput1_clickHandler(event:MouseEvent):void {
                event.currentTarget.setStyle("color", "#0000ff");
                backgroundColorFill.color = 0x00ff00;
        ]]>
    </fx:Script>
    <s:Group>
        <s:Rect width="100%" height="100%">
            <s:fill>
                <s:SolidColor id="backgroundColorFill" color="#00ffff"/>
            </s:fill>
        </s:Rect>
        <s:TextInput contentBackgroundAlpha="0" text="Hello color filled World" click="textinput1_clickHandler(event)"/>
    </s:Group>
</s:View>

Similar Messages

  • Dynamically changing the color of nodes in a JTree

    I have created a JTree and want to dynamically change the color of some of the TreeNodes as my program runs. The JTree is displayed in a JPanel. There is an algorithm built into which identifies the nodes whose color I need to change. No user actions is performed (everythign is internal to the program).
    It seems that in the TreeCellRender only kicks in when the tree is first displayed. How do I get it to re-render the tree when the TreeModel changes? It seems that the Listeners are only looking for external user interactions.
    Any help would be greatly appreciated.
    Thanks!

    I think I was a bit too vague in my question. Let me try again...
    I have changed an attribute in a node in a JTree. This attribute is changed after the tree was initially rendered, but while the program is still running. I want to tell the TreeCellRenderer to look again at this node since that attribute that was changed will effect how the node should be renderered. I tried using the nodeChanged() method, but it did not work (the colot of the node did not change). Any advise how I can do this?
    Thanks!

  • Change graph color dynamically in Discoverer

    Hi,
    Is it possible to change the background color for a graph based on certain condition? If so, how should I do it?
    Thanks,

    No - you cannot dynamically change the color of a graph or graph element in Discoverer.
    Thanks
    Abhinav
    Oracle Business Intelligence Product Management
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    Documentation: http://www.oracle.com/technology/documentation/appserver1012.html
    Discoverer: http://www.oracle.com/technology/products/discoverer/
    BI Software: http://www.oracle.com/technology/software/products/ias/devuse.html
    BI Samples: http://www.oracle.com/technology/products/bi/samples/
    Blog: http://oraclebi.blogspot.com/

  • Dynamically changing row color in an ADF table?

    Hi,
    I am using Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. Can anyone please let me know the code for dynamically changing the row color of an ADF table?
    Thanks,
    Vik

    well you can use EL on af:column inlineStyle property to change the color on condition
    e.g
    inlineStyle='#{(row.SelectedRow)?"background-color: Silver":""};a example can be found here it is changing color based on Checkbox selection http://baigsorcl.blogspot.com/2010/06/deleting-multi-selected-rows-from-adf.html

  • Help Needed : Changing the Color of Bar Graph Dynamically

    Hi..
    Is der any body to help me out...?
    My Question is :- How to change the color of Bar graph Dynamically..
    For example (Assume when one of the Bar Graph crosses certain limit of Y axis value mentioned, the graph must be changed into RED color)
    Thanks in Advance
    Edited by: user12873839 on Mar 30, 2010 10:03 PM

    Manoj,
    You have to create the entire chart manually. follow the below steps. You can refer to the anychart website for more help on different tags and features.
    1. Enter the following code in the html header of the page
    <script src="#WORKSPACE_IMAGES#AnyChart.js"  type="text/javascript" > </script>2. Create an ON Demand Application process by going to the Home>Application Builder>Application #>Shared Components>Application Processes
    3. Click On Create
    4. Enter the name as DYNAMIC_BAR_GRAPH_CHART
    5. Select the processing point as On Demand
    6. Click on Nxt
    7. Enter the following code in the processing text
    DECLARE
    BEGIN
    OWA_UTIL.mime_header ('text/xml', FALSE);
    OWA_UTIL.http_header_close;
    HTP.p ('<?xml version = "1.0" encoding="utf-8" standalone = "yes"?>');
    HTP.p ('<anychart>');
         HTP.p ('<settings>');
              HTP.p ('<animation enabled="True"/>');
         HTP.p ('</settings>');
      HTP.p ('<charts>');
       HTP.p ('<chart plot_type="CategorizedVertical">');
         HTP.p ('<data_plot_settings default_series_type="Bar">');
              HTP.p ('<bar_series>');
                        HTP.p ('<tooltip_settings enabled="True">');
                        HTP.p ('<position valign="Top" halign="Right"/>');
                        HTP.p ('<format> Name: {%Name}');
                        HTP.p ( 'Value : ${%YValue}{numDecimals:0}');
                        HTP.p ('</format>');
                        HTP.p ('<font bold="false"/>'); 
                        HTP.p ('<background>');
                        HTP.p ('<corners type="Rounded" all="3"/>');
                        HTP.p ('<border type="Solid" color="DarkColor(%Color)" thickness="2"/>');
                        HTP.p ('</background>');
                   HTP.p ('</tooltip_settings>');
              HTP.p ('</bar_series>');
         HTP.p ('</data_plot_settings>');
         HTP.p ('<data>');
              HTP.p ('<series name="series 1">');
               FOR cThis IN (select table2.name, table2.value
                                  from table1,table2,table3
                                  where table1.T1ID = table3.T3ID
                                  and table2.T3ID = table3.T3ID
                                  and table3.C_ID=1
                                  and table3.A_ID=1
                        ORDER BY table2.name )
              LOOP
                   IF cThis.value > 90 THEN
                        HTP.p ('<point name="' || cThis.name || '" y="'|| cThis.value || '" color="red"/>');
                    ELSE
                        HTP.p ('<point name="' || cThis.name || '" y="'|| cThis.value || '" />');
                   END IF;
              END LOOP;
              HTP.p ('</series>');
         HTP.p ('</data>');
         HTP.p ('<chart_settings>');
              HTP.p ('<title>');
                   HTP.p ('<text>Chart Title</text>');
              HTP.p ('</title>');
              HTP.p ('<axes>');
                   HTP.p ('<y_axis>');
                        HTP.p ('<title>');
                             HTP.p ('<text>Value</text> ');
                        HTP.p ('</title>');
                        HTP.p ('<labels>');
                             HTP.p ('<format>${%Value}{numDecimals:0}</format>');
                        HTP.p ('</labels>');
                   HTP.p ('<axis_markers>');
                   HTP.p ('</axis_markers>');
                   HTP.p ('</y_axis>');
                   HTP.p ('<x_axis position="Normal" align="inside">');
                   HTP.p ('<labels display_mode="Rotated" rotation="90" align="inside" />');
                   HTP.p ('<title>');
                        HTP.p ('<text>Name</text> ');
                   HTP.p ('</title>');
                   HTP.p ('</x_axis>');
              HTP.p (' </axes>');
         HTP.p ('</chart_settings>');
        HTP.p ('</chart>');
      HTP.p ('</charts>');
    HTP.p ('</anychart>');
    htmldb_application.g_unrecoverable_error := true;
    END;8. Click on Create Process
    Now we will create a html region to display the graph.
    9. Create a new region of type HTML on the same page and select the region template as no template.
    10. Enter the following code in the region source
    &lt;div id="DynamicaBarGraph"></div>
    &lt;script type="text/javascript" language="javascript">
    function DynamicaBarGraph()
    var DynamicaBarGraph = new AnyChart('/i/flashchart/swf/AnyChart.swf');
    //    DynamicaBarGraph.width = "400";
    //    DynamicaBarGraph.height = "400";
    DynamicaBarGraph.addEventListener('pointClick', onDynamicaBarGraphClick);
        var DynamicaBarGraphData = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=DYNAMIC_BAR_GRAPH_CHART',0);
        gReturn = DynamicaBarGraphData.get();
        DynamicaBarGraph.setData(gReturn);
        DynamicaBarGraph.write("DynamicaBarGraph");
    function onDynamicaBarGraphClick(e)
    // Read point name
         name=e.data.Name;
    // Read point value
         value=e.data.YValue;
    // You can add onclick even here using the values name and value
    DynamicaBarGraph();
    </script> Hope it helps. Thanks.
    Regards,
    Manish

  • Change Text Color Dynamically Depending on Which MP3 File is Playing

    Change Text Color Dynamically Depending on Which MP3 File is
    Playing
    Hi,
    Can anyone help with this problem.
    I am trying to change a text cast member's color dynamically
    based on which audio file is currently playing.
    I have 4 Text Cast member buttons named
    Play Song 1
    Play Song 2
    Play Song 3
    Play Song 4
    I am successfully playing the 4 songs in a queue like this
    (ie. If "Play Song 1" sprite text member is pressed then...
    sound(1).queue(member "Song1")
    sound(1).queue(member "Song2")
    sound(1).queue(member "Song3")
    sound(1).queue(member "Song4")
    sound(1).play
    What I would like to do is to have the currently playing song
    text color changed to a different value, say Green.
    So if "Song2" in the queue starts to play then the text "Play
    Song 2" would become Green. When done it would then turn back to
    black then "Song3" starts to play and "Play Song 3" text script
    button would then turn from black to Green an so on.
    These are the codes I've tried in the frame script and none
    seem to work...
    on enterFrame me
    if sound(1).status = 3 then member("Play Song 1").foreColor=5
    (This works but only for the first song because "Play Song 1"
    is directly named and clicked on.)
    else member("Play Song 1").foreColor=255
    end if
    I have tried to make a reference to the playing song and so
    far each of these doesn't work...
    --if sound(1).status = 3 then
    sprite(me.sound.member).foreColor=5
    --if sound(1).status = 3 then
    sprite(me.spriteNum).member.color=rgb(0,255,0)
    --if sound(1).status = 3 then member
    (sound(1).member).foreColor=5
    --text = member(whichMember).scriptText
    end
    Is there any way to reference the song name text cast
    member??
    I thought I had it when I discovered sound(1).member but
    sound(1).showProps returns the playing sound.member as
    member: (member 28 of castLib 1) nothing there I can use?
    It doesn't show the member name and
    It doesn't show the song name "Song1" which I could then
    match up to the "Play Song 1" text
    I'm pretty new to lingo so specific code examples would be
    appreciated.
    Can anyone help??? Thanks!!!

    did you get anywhere with this?
    When applying a styleClass to a af:showDetailItem, it doesnt seem to have any effect whatsoever.

  • Changing textfield cursor color in Forms

    Hi All,
    We are using Oracle App Server 9iAS and 9iDS. I need to change the color of my cursor for the text field/or change the cursor to a block cursor in forms application. Does any one know how that can be done ?.
    TIA
    Saurabh

    Saurabh,
    changing the color of a cursor is more difficult than changing its shape. You can use a PJC to change the cursor shape to one of the standard shapes. If you need a custom cursor then you still can used a PJC, but designing your own cursors in Java is not trivial.
    See:
    http://www.oracle.com/technology/sample_code/products/forms/demo/9i/javabeans_pjc_samples/mod_cursor/viewlet/pjc_modcursor_viewlet.html
    which is available in the Forms 9i demos at
    http://www.oracle.com/technology/sample_code/products/forms/index.html
    Frank

  • Changing Tab Color

    I have been struggling for a while with trying to change the color of a tab, after it's been displayed.  Some background is that i have a multi tab window.  If something happens in one of the windows, I want to bring attention to that tab and color the tab red.
    I am dynamically adding the tabs to the tab navigator from  database table.  I read them in with their data and when I have them all I build up the tab navigator.  My TabObject is really a Canvas that I have extended.
                    private function AddTabsToTabNavigator():void
                        var lIsFirst:Boolean = true;
                        for each ( var lTab:TabHandler in mTabDictionary )
                            // Create our Frame Canvas that we are going to add to the Tab Navigator
                            var lTabItem:TabObject         = new TabObject();
                            lTabItem.name                  = lTab.GetTabName();
                            lTabItem.SetRefreshTime(lTab.GetTabRefreshInterval());
    //lTabItem.setStyle( "tabStyleName", "tabStyleGreen" );
    //lTabItem.styleName = Constants.TAB_STYLE_GREEN;
    //TAB_NAVIGATOR.invalidateDisplayList();
    lTabItem.setStyle( "backgroundColor", "green");                       
                            TAB_NAVIGATOR.addChild( lTabItem );
    I've tried a number of things comented out here.  I have a CSS and I can set the initial color of the tab no problem.
    mx|TabNavigator
        tab-width: 110;
        horizontal-gap: 3;
        tabStyleName: tabStyleYellow;
        selectedTabTextStyleName: tabSelectedText;
    .tabStyleYellow
        font-size: 10;
        corner-radius: 10;
        fill-colors: yellow, #FFFFFF; /* #9D9DA0, #FFFFFF */
        fill-alphas: 1.0, 1.0;
        background-color: #FFFFFF; /*6486AC*/
    But I don't see how I can go back and change the tab color.   Am I missing something
    Here is another way I've tried.
                    public function ChangeTabStyle( aTabName:String, aStyleName:String ):void
                         var lActiveTab:TabObject = TAB_NAVIGATOR.getChildByName( aTabName ) as TabObject;
    //                    var lTab:DisplayObject = TAB_NAVIGATOR.getChildAt( mCurrentTabSelected ) as Tab
                        if ( null != lActiveTab )
                            lActiveTab.setStyle( "tabStyleName", "tabStyleBlue" );
    //                        lActiveTab.styleName = aStyleName;
    //                        lActiveTab.setStyle("fillColors", ["red", "white"]);
    //                        lActiveTab.setStyle("backgroundColor", "red");

    I have been struggling for a while with trying to change the color of a tab, after it's been displayed.  Some background is that i have a multi tab window.  If something happens in one of the windows, I want to bring attention to that tab and color the tab red.
    I am dynamically adding the tabs to the tab navigator from  database table.  I read them in with their data and when I have them all I build up the tab navigator.  My TabObject is really a Canvas that I have extended.
                    private function AddTabsToTabNavigator():void
                        var lIsFirst:Boolean = true;
                        for each ( var lTab:TabHandler in mTabDictionary )
                            // Create our Frame Canvas that we are going to add to the Tab Navigator
                            var lTabItem:TabObject         = new TabObject();
                            lTabItem.name                  = lTab.GetTabName();
                            lTabItem.SetRefreshTime(lTab.GetTabRefreshInterval());
    //lTabItem.setStyle( "tabStyleName", "tabStyleGreen" );
    //lTabItem.styleName = Constants.TAB_STYLE_GREEN;
    //TAB_NAVIGATOR.invalidateDisplayList();
    lTabItem.setStyle( "backgroundColor", "green");                       
                            TAB_NAVIGATOR.addChild( lTabItem );
    I've tried a number of things comented out here.  I have a CSS and I can set the initial color of the tab no problem.
    mx|TabNavigator
        tab-width: 110;
        horizontal-gap: 3;
        tabStyleName: tabStyleYellow;
        selectedTabTextStyleName: tabSelectedText;
    .tabStyleYellow
        font-size: 10;
        corner-radius: 10;
        fill-colors: yellow, #FFFFFF; /* #9D9DA0, #FFFFFF */
        fill-alphas: 1.0, 1.0;
        background-color: #FFFFFF; /*6486AC*/
    But I don't see how I can go back and change the tab color.   Am I missing something
    Here is another way I've tried.
                    public function ChangeTabStyle( aTabName:String, aStyleName:String ):void
                         var lActiveTab:TabObject = TAB_NAVIGATOR.getChildByName( aTabName ) as TabObject;
    //                    var lTab:DisplayObject = TAB_NAVIGATOR.getChildAt( mCurrentTabSelected ) as Tab
                        if ( null != lActiveTab )
                            lActiveTab.setStyle( "tabStyleName", "tabStyleBlue" );
    //                        lActiveTab.styleName = aStyleName;
    //                        lActiveTab.setStyle("fillColors", ["red", "white"]);
    //                        lActiveTab.setStyle("backgroundColor", "red");

  • How can I change the color of plot in a waveform chart and graph?

    There are 4 plots in a waveform chart, from plot0 to plot3, and I want to chang the color of plots dynamicly up to my needs when the VI is running.
    For example, as show in the picture, i want to set the plot0 as RED, and plot1 is BLUE, plot2 is YELLOW, plot3 is GRAY.
    If there is only one plot, i can change it's color, however when there are more than one plot, it fail.
    How can I do it?
    Thanks
    Attachments:
    waveform.JPG ‏61 KB

    Hello MilkyStone,
    first you have to set the active plot, then change its color (or other properties). All that is done using property nodes.
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How Can I change the color in a 3d object?

    Hello.
    I have received a 3dPDF, on which several buildings are created in 3d. Is it possible afterwards to change the color of the buildings in Acrobat X Pro? Or do I need the plugin "Tetra4D"?
    Thank you for your help.
    Greeting
    Sascha

    You can change the color of model parts dynamically at runtime using JavaScript, but there is no way to change them within the embedded model itself.

  • How to change background color in iWeb Header?

    I cannot change Header background color nor make it smaller.  I've gone into Inspector and zeroed out Header height, nothing changed. Color is problem.

    That the Fine Line theme, correct?  Try this:  delete the shape that's above the navbar. Move the navbar down till you get the right amount of white space above it.  Then use the following code in an HTML snippet to change the navbar background to white:
    <script language="JavaScript" type="text/javascript"><!--
    function navBackgroundColor () {
    elem = parent.document.getElementById('nav_layer');
    elem.style.backgroundColor = "#5D68C3";
    clearInterval(chkNavLink);
    chkNavLink = setInterval('navBackgroundColor()', 500);
    // -->
    </script>
    Change #5D68C3 to #FFFFFF for a white background.  You could try setting backgroundColor = "#5D68C3" to backgroundColor = "" for a transparent background (not sure of this but worth a try).
    OT

  • How to change the color of the text in the Text Field or in the text area??

    HI all,
    i think its a very simple problem, still, can anyone tell me how i can change the color of the text and also its font, before i display it in either a textfield or a text area.
    bharath

    Just Use:
    JTextField.setForeground(Color.RED);
    so SIMPLE na!
    Balakumar .M
    http://i5bala.blogspot.com
    --

  • Change the color of the text in textpane

    please suggest me how to change the color of the selected text color in textpane in jpanel
    class ComposeMailPanel extends JPanel implements ListSelectionListener, ActionListener, ItemListener
    JFrame frame;
    JTextPane jtextpane;
    JButton bInsertPic;
    JButton bBackgroundColor;
    JButton bForegroundColor;
    JFileChooser selectedFile;
    JFileChooser insertIconFile;
    JColorChooser backgroundChooser;
    JColorChooser foregroundChooser;
    JComboBox fontSize;
    SimpleAttributeSet sas;
    MutableAttributeSet sas1;
    StyleContext sc;
    DefaultStyledDocument dse;
    JScrollPane mainScrollPane;
    RTFEditorKit rtfkit;
    JComboBox fontFamily;
    MutableAttributeSet mas;
    Color backgroundColor;
    Color foregroundColor;
    String SF = "";
    public ComposeMailPanel()
         setLayout(null);
    bInsertPic = new JButton("Insert picture");
    add(bInsertPic);
    bInsertPic.setBounds(150,460,110,20);
    bInsertPic.setBackground(new Color(0,139,142));
    bInsertPic.setForeground(new Color(255,255,255) );
    bInsertPic.setBorder(borcolor);
    bInsertPic.addActionListener(this);
    bForegroundColor = new JButton("Set foreground color");
    add(bForegroundColor);
    bForegroundColor.setBounds(270,460,130,20);
    bForegroundColor.setBackground(new Color(0,139,142));
    bForegroundColor.setForeground(new Color(255,255,255) );
    bForegroundColor.setBorder(borcolor);
    bForegroundColor.addActionListener(this);
    fontFamily=new JComboBox();
    combofontfamilyinitialize();
    add(fontFamily);
    fontFamily.setBounds(420,460,110,20);
    fontFamily.setBackground(new Color(0,139,142));
    fontFamily.setForeground(new Color(255,255,255) );
    fontFamily.setBorder(borcolor);
    fontFamily.addItemListener(this);
    fontSize = new JComboBox();
    add(fontSize);
    fontSize.setBounds(550,460,40,20);
    fontSize.setBackground(new Color(0,139,142));
    fontSize.setForeground(new Color(255,255,255) );
    fontSize.setBorder(borcolor);
    fontSize.addItemListener(this);
    combofontsizeinitialize();
    sas = new SimpleAttributeSet();
    sas1 = new SimpleAttributeSet();
    sc = new StyleContext();
    dse = new DefaultStyledDocument(sc);
    rtfkit = new RTFEditorKit();
    selectedFile = new JFileChooser();
    insertIconFile = new JFileChooser();
    backgroundChooser = new JColorChooser();
    foregroundChooser = new JColorChooser();
         JScrollPane scrollPane2 = new JScrollPane();
         add(scrollPane2);
         scrollPane2.setBounds(150,300,577,152);
         jtextpane= new JTextPane();
         scrollPane2.getViewport().add(jtextpane);
         jtextpane.setBounds(150,300,572,150);
         jtextpane.setDocument(dse);
         jtextpane.setContentType( "text/html" );
         jtextpane.setEditable( true );
         jtextpane.setBackground(new Color(255,255,255));
         //jtextpane.setFont(new Font( "Serif", Font.PLAIN, 12 ));
         jtextpane.setForeground(new Color(0,0,0) );
         setBackground(new Color(0,139,142));
              }//constructor
    public void combofontfamilyinitialize ()
    GraphicsEnvironment ge1 = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String[] k = ge1.getAvailableFontFamilyNames();
    fontFamily= new JComboBox(k);
    public void combofontsizeinitialize ()
    //This function fills the combo box with font sizes
    fontSize.addItem("8");
    fontSize.addItem("9");
    fontSize.addItem("10");
    fontSize.addItem("11");
    fontSize.addItem("12");
    fontSize.addItem("14");
    public void setAttributeSet(AttributeSet attr)
    //This function only set the specified font set by the
    //attr variable to the text selected by the mouse
    int xStart, xFinish, k;
    xStart = jtextpane.getSelectionStart();
    xFinish = jtextpane.getSelectionEnd();
    k = xFinish - xStart;
    if(xStart != xFinish)
    dse.setCharacterAttributes(xStart, k, attr, false);
    else if(xStart == xFinish)
    //The below two command line updates the JTextPane according to what
    //font that is being selected at a particular moment
    mas = rtfkit.getInputAttributes();
    mas.addAttributes(attr);
    //The below command line sets the focus to the JTextPane
    jtextpane.grabFocus();
    public void actionPerformed(ActionEvent ae1)
    JComponent b = (JComponent)ae1.getSource();
    String str3 = null;
    frame = new JFrame();
    if(b == bInsertPic)
    System.out.println("inside insertpic");
    insertIconFile.setDialogType(JFileChooser.OPEN_DIALOG);
    insertIconFile.setDialogTitle("Select a picture to insert into document");
    if(insertIconFile.showDialog(frame,"Insert") != JFileChooser.APPROVE_OPTION)
    System.out.println("inside icon");
    return;
    File g = insertIconFile.getSelectedFile();
    ImageIcon image1 = new ImageIcon(g.toString());
    jtextpane.insertIcon(image1);
    jtextpane.grabFocus();
    else if(b == bForegroundColor)
              foregroundColor = foregroundChooser.showDialog(frame, "Color Chooser", Color.white);
    if(foregroundColor != null)
    String s1=jtextpane.getSelectedText();
         StyleConstants.setForeground(sas, foregroundColor);
    setAttributeSet(sas);
    public void itemStateChanged(ItemEvent ee5) {
    JComponent c = (JComponent)event.getSource();
    boolean d;
    if(c == fontFamily)
    String j = (String)fontFamily.getSelectedItem();
    StyleConstants.setFontFamily(sas, j);
    setAttributeSet(sas);
    else if(c == fontSize)
    String h = (String)fontSize.getSelectedItem();
    int r = Integer.parseInt(h);
    StyleConstants.setFontSize(sas, r);
    setAttributeSet(sas);
    thanks in advance

    Learn how to use the forum correctly by posting formatted code.
    Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html]Text Component Features.

  • Is there a way to change the colors of multiple VI front panels?

    Hi,
    I am currently creating a LabView program controlling a lot of sensors and actuators. I have based the GUI on a tab-control with different buttons which again opens up different VI front panels in a singel sub panel below. I realy want to have a different color theme on my program than the standard gray LabView theme, but I would like to change the colors for all my VIs in a smooth and quick way. I really would not like to click on all controls, indicators etc. to get new colors, as there are a lot of them! Any ideas out there, if this is possible?
    Thanks in advance!
    Lars

    Lars,
    please note that using the grayscale theme is recommended not only by NI. Using color is very delicate thing since you have to consider:
    - readability of text might suffer due to insufficient contrast
    - overuse of (signaling) color might distract the user from important settings/information
    - color-blind user?
    That being said, you can color the frontpanels of the VIs you include in the sub panel dynamically. Please take a look into attached example on how this could be done (LV 2009).
    Please note that this is recoloring the frontpanel background only. If you need other elements to recolor as well, this can be done similar but is more effort....
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.
    Attachments:
    FP ColorChange.vi ‏14 KB

  • PS Script - Change Layer Color

    This Is My First Post Here, So Hello Everyone,
    Hope I Am Posting In The Right Section,
    I Have A Photoshop File Which Looks Like Shown Above..
    The Text 1 2 3 ...15 Are Different Layers..
    And The Boxes Are Different Layers, Named i1 i2 i3 ...... i15
    I Want To Write A Script That Will Change The Color Of Boxes (Actually This Is Legend Section For A Pie Chart)
    I Want To Write Very Hard-Coded Script, Nothing Dynamic,
    Like
    layer[i1].color = #9f13a8
    layer[i2].color = #520457
    layer[i3].color = #cc626c
    layer[i4].color = #aa5705
    I Tried Searching Around, But Very Less Help Available On ps-script And Complicated Examples....
    I Just Want Some Simple Lines, How To Easily Reference A Layer By Name And Change The Color (Forecolor, I Guess)
    I Wrote This But It Does Not Works
    var myDocument = app.activeDocument;
    var myLayer;
    myLayer=myDocument.artLayers.getByName("i1");
    myLayer.color="#9f13a8";
    I Don't Know If .artLayers Is Only For Text Layers Or Something.. I Found It In An Example...
    Thanks

    If you want to apply a pattern you can use scriptlistener to generate the code. It might be best to create the shape first by either drawing it or by using scriptlistener to generate the code, then use scriptlistener to generate code to change the fill pattern. This way you can use that code for any type of shape layer: oval, rectangle, etc. If you don't want a dialog box, you will have to find both the name and id number for the pattern used - again, this will show up using scriptlistener. If you want have a dialog box come up and be able to select which pattern you want to use, change the last line of the scriptlistener code to:
    executeAction( idsetd, desc10, DialogModes.ALL );
    But be sure to reset the dialog mode to No after that line. Here's an example of the code for changing a pattern:
    #target photoshop
    var idsetd = charIDToTypeID( "setd" );
        var desc10 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref2 = new ActionReference();
            var idcontentLayer = stringIDToTypeID( "contentLayer" );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref2.putEnumerated( idcontentLayer, idOrdn, idTrgt );
        desc10.putReference( idnull, ref2 );
        var idT = charIDToTypeID( "T  " );
            var desc11 = new ActionDescriptor();
            var idPtrn = charIDToTypeID( "Ptrn" );
                var desc12 = new ActionDescriptor();
                var idNm = charIDToTypeID( "Nm  " );
                desc12.putString( idNm, """$$$/Presets/Patterns/Patterns_pat/TieDye=Tie Dye""" );//pattern name
                var idIdnt = charIDToTypeID( "Idnt" );
                desc12.putString( idIdnt, """1b29876b-58b7-11d4-b895-a898787104c1""" );//pattern ID number
            var idPtrn = charIDToTypeID( "Ptrn" );
            desc11.putObject( idPtrn, idPtrn, desc12 );
        var idpatternLayer = stringIDToTypeID( "patternLayer" );
        desc10.putObject( idT, idpatternLayer, desc11 );
    executeAction( idsetd, desc10, DialogModes.ALL );//Change the NO to ALL
    app.displayDialogs = DialogModes.NO;//Make sure you reset!!!

Maybe you are looking for

  • Idoc Structure From Flat FIle

    Hi, I have two queries. 1.I need to import idoc structure from excel file not from sap, is it possible ? 2 what are the detalied steps to implement following SAP note for getting processed file name at runtime. Thanks & Regards Tuhin Symptom You want

  • Use the command "Properties" in Windows Explorer to unlock the file

    I'm getting this error where, when I start Photoshop, I get a popup saying "Cannot load Photoshop because the file is locked or you don't have the needed privileges.. Use the command "Properties" in Windows Explorer to unlock the file". I unlocked it

  • Podcasts in the song list

    Ipod can distinguish between podcasts and songs but seems to list them together under the 'Songs' menu selection. Is there a way to exclude podcasts from the Songs list without creating playlists?

  • Excise Under Bond

    Hi Gurus, The scenario is like this. My client procure goods from different countries.The all import goods are not taken to the warehouse.Instead they kept in bonded warehouse. Partially they are withdrawing the materials and accordingly make payment

  • Gnome-open opens urls only in firefox [SOLVED]

    Hi, I've been facing a problem since I switched from firefox to chromium, all the apps open urls in firefox. I've been investigating a little to find xdg-open uses gnome-open to open my urls. I've set up custom/chromium %s in Preffered Applications (