String text color

I am trying to do the following.
I have a VI which updates the current weight of an item and compared it to the initial weight through division, when it is between 10%<item<25% I have it inserting into an array (that has all the item information) a string that says "Item Low". Then if it is below 10% this message will read "Item Critically Low". So this writes into a particular item's row in the last available column. What I am looking to do is make it user friendly by displaying the message as a color, which would be yellow for Low and Red for critically low. I can't do a property node for the entire string array on the front panel because I only want this color in one particular cell. Is there any way that I can just change the font color of the string that I have attached to the newelement/subarray node in the insert into array icon.

Use the CellBG property .. something like this
Regards
Guru (CLA)
Attachments:
1.png ‏19 KB

Similar Messages

  • Programmatically changing string text color in an array of string indicators

    Hi,
    I have an array of string indicators and I'm trying to format certain values different colors.  While I'm able to do this on a single string indicator I can't figure out how to handle the indexing of the array.  I have seen several examples with array of clusters but I am unable to translate to array of string indicators.
    Any help would be appreciated.
    Regards,
    ShotSimon
    Attachments:
    Changing text color in an array of string controls.vi ‏9 KB

    Instead of a string array, where all elements have the same format, you should use a table, which basically behaves as a 2D string array. But there, you can adjust all text attributes (if you are using LV 8.x). See this thread
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How to change the text color to red in a combo box?

    I'm writing a java program which have a combo box which shows all the name of the member from the database. However, I would like to change the text color of those member who have now currently on-line.
    Please help, it's URGENT. Thanks in advance.
    Clark

    hi,
    as i mentioned, you would require to use a custom renderer for this, for this
    //Class subclass the JFrame and has a JList in it
    import javax.swing.*;
    import java.awt.*;
    import java.util.Vector;
    public class ListRendererTest extends JFrame
         private JList lstMenu;
         private DefaultListModel defaultListModel;
         private JScrollPane scrollPane;
         private Vector listVector;
         public ListRendererTest()
              init();
              addComponents();
              showFrame();
         public void init()
              lstMenu = new JList();
              defaultListModel= new DefaultListModel();
              lstMenu.setModel(defaultListModel);
              scrollPane      = new JScrollPane(lstMenu);
              listVector = new Vector();
              MyListData m1 = new MyListData();
              m1.setName("Rakesh");
              m1.setOnline(false);
              listVector.addElement(m1);
              m1 = new MyListData();   //represents each User instance
              m1.setName("Makesh");
              m1.setOnline(true);
              listVector.addElement(m1);
              for (int i=0;i < listVector.size(); i++)
                   defaultListModel.addElement(((MyListData)listVector.elementAt(i)));
              lstMenu.setCellRenderer(new MyListRenderer());  //set custom renderer
         public void addComponents()
              getContentPane().add(scrollPane,BorderLayout.CENTER);
         public void showFrame()
              setTitle("List renderer test");
              setSize(300,300);
              setLocation(200,200);
              setVisible(true);
         public static void main(String args[])
              new ListRendererTest();
    }The above class is the Container which houses the JList in it, it uses two other classes, MyListData which is used to represent each user instance ( username, and information about whether he is online) and MyListRenderer (custom renderer).
    // Represents each user instance //
    public class MyListData
         private String name;
         private boolean online;
         public void setName(String name)
              this.name = name;
         public String getName()
              return name;
         public void setOnline(boolean online)
              this.online = online;
         public boolean isOnline()
              return online;
    //custom list renderer
    import javax.swing.*;
    import java.awt.*;
    public class MyListRenderer extends DefaultListCellRenderer
         private MyListData myListData;
         public Component getListCellRendererComponent(JList list, Object value, int index,  boolean isSelected, boolean cellHasFocus)
               myListData = (MyListData)value;
               setText(myListData.getName());
               setBackground(myListData.isOnline() ? Color.red: Color.white);  //check if online, if so show in different color
               setForeground(isSelected ? Color.blue : Color.black);
               return this;
    }hope that helps.
    cheerz
    ynkrish

  • Work with JTable cell (check input, set text color)

    I have a JTable with data
    The task is:
    User inputs some data into cell
    I want to check his input string for equatily with other values in column
    For example, I have these values in column:
    1.example
    2.exercise
    3.execute
    User inputs word "execution" in the same column
    until user inputs "executi" his input string should be red.
    What event I have to listen to if I want to get user input string?
    Also a question:
    Is there any opportunity to work with cell row (copy it to another JTable) ?
    Message was edited by:
    Holod

    i think you should use cell editor as textfield (although that is default for jtable) and then implements document listener and set text color in insert update method.
    try this out :-)

  • How to identify the text color in a word doc.?

    how to identify the text color in a word doc.?
    I need to read a word document using java code. which contains many strings with different colors.
    i need to identify the color and giving the marks accordingly like
    test in blue color so
    test marks=2
    how can i do this using java. i only want to know how can i identify the text color using java code.?

    morgalr wrote:
    I guarantee it is not pretty.Indeed.
    I created a Word doc that simply has the word "Blue" in blue, then a space, then the word "Red" in red, all in the default font that Word started with (Times New Roman). The resulting document is 24,064 bytes. It starts off with 80 bytes of various hex values, mostly 0x00.Then 432 bytes of just 0xFF. Then 2048 bytes of various hex values, mostly 0x00. Then the text "Blue Red" (which appears twice more in the file). And so on...
    Edited by: jverd on May 10, 2010 8:45 AM

  • Changing dynamic text colors ??

    In Flash 8, the dynamic text field instance name is
    energyLevel, as is the variable name associated with it. This
    field's text color was originally set to gold (outside of
    ActionScript). In the code, I'm trying to change it to red (without
    a condition at this point, just to see if it will work).
    In the code prior to the init function:
    energyLevel = 10;
    I've tried Option 1: >>>>>>>>>>
    newTextStyle = new TextFormat();
    newTextStyle.color = "0xFF0000";
    actor.onEnterFrame = function() {
    energyLevel.setTextFormat(newTextStyle);
    I've tried Option 2:
    >>>>>>>>>>>>>
    actor.onEnterFrame = function() {
    energyLevel.textColor = 0xFF0000;
    And, I've tried Option 3:
    >>>>>>>>>>>>
    actor.onEnterFrame = function() {
    _root.energyLevel.textColor = 0xFF0000;
    BUT, none work. This should be easy to do. Can anyone tell me
    what is wrong??
    Thanks!

    not exactly, read:
    HERE
    What if you are tracking a value that you don't want to
    display at the time, or want use it in other calculations. Also
    there are a few other ways to enter what you've got there, as in:
    amountLeftField.text -= AmountFraction*.332;
    amountLeftField.text *=.332;
    amountLeftField.text /=1.332;
    OR how about ...
    a_txt.text -= f*.332;
    Flash recognizes operations on a numerical value entry,
    performs the calc, and still displays as a String.
    Additionally, if you use the underscore with an extention
    name for instance naming as in 'my_txt', Flash will recognize the
    extention and bring up a list of methods, properties and event
    handlers related to the data type when you type 'dot' after, if you
    have the 'code hints' preference turned on. Same with _mc, _btn,
    _ldr, _ti, _cb, ... etc. good for learning, and as you type the
    next few characters of the prop, the list will highlight the prop,
    and you can hit 'enter' to complete the rest, handy.
    I'm not certain, but I believe that the TextField Var
    property has been eliminated entirely in AS3. (?)

  • Dynamic text color

    I am trying to use an xml document to dynamically load the
    text color into my movie, and i can get the color, but when I try
    to use that value to change the text color, it doesn't do anything,
    how can I get this to work?
    Thanks
    This is my code:

    There are two issues here I think.
    1. Getting the correct value.
    var txtColor:Number =
    XPathAPI.selectSingleNode(this.firstChild, path+"/textColor/*");
    This probably gives you a correct trace (if the xpath is
    correct for what you want to do) but the trace is misleading.
    trace applies the toString method to its arguments (I
    believe). And putting the :Number there doesn't make it a number,
    the compiler just treats it like one.
    What you actually have is this:
    var txtColor:XMLNode =
    XPathAPI.selectSingleNode(this.firstChild, path+"/textColor/*");
    and if
    trace(txtColor.nodeType)
    shows '3' then you have a textNode which contains the value
    you're after.
    So, try this:
    var txtColor:Number =
    Number((XPathAPI.selectSingleNode(this.firstChild,
    path+"/textColor/*").nodeValue);
    This *should* get you the value you need.
    2. Assigning the value
    If the above works, then assigning the number should be
    fine...but just to clarify the other points....
    Regardless of whether its flash 8 or flash CS3 the compiler
    will give an error with the string assignment to a textfield's
    textColor property if your textfield has been declared as a
    TextField.
    E.g.
    This fails:
    var testtext:TextField;
    testtext.textColor ="0xff00ff";
    But this works without the declaration:
    testtext.textColor ="0xff00ff";
    If you're getting that error then you need to use
    Number(stringValue) and it will work.

  • Setting the text color

    Hi
    Does anybody know the syntax for changing the text color for workspace customization ?
    like for backgorund color ,we have color = "background-color:IndianRed"
    Ritu

    Hi Ritu,
    If you're trying to change the color inside of the bpmworkspace.css (the default CSS for the Workspace) to Indian Red you could do this:
    .bpmWorkspaceHeaderUser {
         background-color:#cd5c5c;
         width:100%;
         text-align:right;
    . . .If you're trying to change the background or foreground color of a label or field on a BPM Object presentation, you could do this:
    // set the first label on a presentation to Red
    setForegroundColor this
       using componentId = "label0", 
          color = Fuego.Ui.Color.INDIAN_RED.rgb()
    // set the first text field's background color to Red
    setBackgroundColor this
       using componentId = "text0", 
          color = Fuego.Ui.Color.INDIAN_RED.rgb()This logic would be run from inside a BPM Object's method to dynamically change colors on a Presenation. This would set the first label's ("label0") foreground and the first text field's ("text0") background color to Indian Red. You'd normally have the method invoked either as an initialization method for the presentation (click the outer edge of a presentation -> click the "Properties" tab -> change the method invoked when the presentation initializes by changing the "Initialization method" property) or as the method invoked by a field's "On change invoke" property.
    Note that "label0" and "text0" are the names of the label and text fields on a specific BPM Object's presentation and not the name of an attribute inside the BPM Object. To uncover their specific names, open the BPM Object presentation -> click the label or field -> open the "Properties" tab on the right -> look at the value inside the "Name" field.
    You can see the other colors available if from the Project Navigator tab if you expand the "Catalog" -> expand "Fuego" -> expand "Ui". The upper case attributes listed are enumerations. The string's needed for the "setForegroundColor" and "setBackgroundColor" methods are returned using the catalog's Fuego.Ui "rgb()" method.
    Hope this helps,
    Dan

  • Changing Label text color based on some conditions

    Hi,
    I have these labels and I would like to change the text color IF the text has some specific value (coming from an XML created by a program); for example the default text color is red, but if the text value is "Yes", the text color should be green.
    Any helps much appreciatted, as usual...
    Thanks.

    unsure, but you might be able to get away with something like this:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[
                public function changeColor(value:String):uint
                    if(value == "Yes")
                        return 0x007F00;
                    else
                        return 0x7F0000;
            ]]>
        </mx:Script>
        <mx:Panel x="343" y="199" width="250" height="200" layout="absolute">
            <mx:Label id="lbl1" text="Yes" color="{changeColor(lbl1.text)}" x="102.5" y="10"/>
            <mx:Label id="lbl2" text="BlahhhhhBlahhhh" color="{changeColor(lbl2.text)}" x="97" y="36"/>
            <mx:Label id="lbl3" text="Exampleeeeeeee"  color="{changeColor(lbl3.text)}" x="97" y="62"/>
        </mx:Panel>
    </mx:Application>
    using a single label in an item renderer, passing across the 'data.text' value

  • Is there any way to set text color of a (NS)Button in IB?

    as the title reads.. is there? i'm using xcode 4.6

    If you are asking about the actual text color then yes it is possible but not so simple.
    If you look at the class definition for NSButton youwill see two methods
    – setAttributedAlternateTitle:
    – setAttributedTitle:
    These will allow you to specify an attributed string as the button label and in the attributed string you can set the  string attributes such as color.
    If you are just looking to change the background color or somehtingalong those lines that can be done right in NSButton.

  • Length of a string (text) in pixels.

    I'm trying to locate a String's center on an exact position, drawing it to a JPanel. But since i don't know the exact length of the string, it's not that easy. Can anybody help me out there?

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class CenteringStrings
        public static void main(String[] args)
            StringDemoPanel demo = new StringDemoPanel();
            DemoActionPanel action = new DemoActionPanel(demo);
            JFrame f = new JFrame("Centering Strings");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(action, "East");
            f.getContentPane().add(demo);
            f.setSize(500,300);
            f.setLocation(200,200);
            f.setVisible(true);
    class StringDemoPanel extends JPanel
        String text;
        Font font;
        final int
            ASCENT   = 0,
            DESCENT  = 1,
            LEADING  = 2,
            BASELINE = 3;
        int index = -1;
        boolean sizeFlag, boundsFlag;
        public StringDemoPanel()
            text = "Centered text";
            font = new Font("lucida sans oblique", Font.PLAIN, 36);
            sizeFlag = false;
            boundsFlag = false;
            setBackground(Color.white);
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics(text, frc);
            TextLayout tl = new TextLayout(text, font, frc);
            int w = getWidth();
            int h = getHeight();
            float textWidth = (float)font.getStringBounds(text, frc).getWidth();
            float ascent  = lm.getAscent();
            float descent = lm.getDescent();
            float leading = lm.getLeading();
            float height  = lm.getHeight();
            float x = (w - textWidth)/2;
            float y = (h + height)/2 - descent;
            g2.drawString(text, x, y);
            // marker for string origin (x,y) on baseline
            //g2.setPaint(Color.blue);
            //g2.fill(new Ellipse2D.Double(x - 1, y - 1, 2, 2));
            // physical space of text
            Rectangle2D textSize = tl.getBounds();
            textSize.setFrame(x, y - textSize.getHeight(),
                              textSize.getWidth(), textSize.getHeight());
            // string bounds
            Rectangle2D bounds = font.getStringBounds(text, frc);
            bounds.setFrame(x, y - ascent - leading, bounds.getWidth(), bounds.getHeight());
            switch(index)
                case ASCENT:
                    Rectangle2D r1 = new Rectangle2D.Double(x, y - ascent, textWidth, ascent);
                    g2.setPaint(Color.magenta);
                    g2.draw(r1);
                    break;
                case DESCENT:
                    Rectangle2D r2 = new Rectangle2D.Double(x , y, textWidth, descent);
                    g2.setPaint(Color.orange);
                    g2.draw(r2);
                    break;
                case LEADING:
                    Rectangle2D r3 = new Rectangle2D.Double(x, y - ascent - leading,
                                                            textWidth, leading);
                    g2.setPaint(Color.yellow);
                    g2.draw(r3);
                    break;
                case BASELINE:
                    Line2D line = new Line2D.Double(x, y, x + textWidth, y);
                    g2.setPaint(Color.blue);
                    g2.draw(line);
            if(sizeFlag)
                g2.setPaint(Color.green);
                g2.draw(textSize);
                System.out.println("above size = " + (int)textSize.getY() + "\n" +
                                   "below size = " +
                                   (int)(h - (textSize.getY() + textSize.getHeight())));
            if(boundsFlag)
                g2.setPaint(Color.red);
                g2.draw(bounds);
                System.out.println("above bounds = " + (int)bounds.getY() + "\n" +
                                   "below bounds = " +
                                   (int)(h - (bounds.getY() + bounds.getHeight())));
        public void setIndex(int i)
            index = i;
            repaint();
        public void setSizeFlag(boolean flag)
            sizeFlag = flag;
            repaint();
        public void setBoundsFlag(boolean flag)
            boundsFlag = flag;
            repaint();
    class DemoActionPanel extends JPanel
        StringDemoPanel sdp;
        JRadioButton
            ascentButton, descentButton, leadingButton, baselineButton, clearButton;
        JRadioButton[] buttons;
        JCheckBox
            sizeCheck, boundsCheck;
        JCheckBox[] checks;
        public DemoActionPanel(StringDemoPanel p)
            sdp = p;
            createComponents();
        private void createComponents()
            ascentButton   = new JRadioButton("ascent");
            descentButton  = new JRadioButton("descent");
            leadingButton  = new JRadioButton("leading");
            baselineButton = new JRadioButton("baseline");
            clearButton    = new JRadioButton("clear");
            buttons = new JRadioButton[] {
                ascentButton, descentButton, leadingButton, baselineButton, clearButton
            ButtonGroup group = new ButtonGroup();
            RadioButtonListener buttonListener = new RadioButtonListener();
            setLayout(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.weighty = 1.0;
            gbc.insets = new Insets(2,2,2,2);
            gbc.gridwidth = gbc.REMAINDER;
            gbc.anchor = gbc.WEST;
            for(int i = 0; i < buttons.length; i++)
                add(buttons, gbc);
    group.add(buttons[i]);
    buttons[i].addActionListener(buttonListener);
    sizeCheck = new JCheckBox("text size");
    boundsCheck = new JCheckBox("bounds");
    checks = new JCheckBox[] { sizeCheck, boundsCheck };
    CheckBoxListener checkBoxListener = new CheckBoxListener();
    for(int i = 0; i < checks.length; i++)
    add(checks[i], gbc);
    checks[i].addActionListener(checkBoxListener);
    private class RadioButtonListener implements ActionListener
    public void actionPerformed(ActionEvent e)
    JRadioButton button = (JRadioButton)e.getSource();
    if(button == clearButton)
    sdp.setIndex(-1);
    return;
    for(int i = 0; i < buttons.length; i++)
    if(button == buttons[i])
    sdp.setIndex(i);
    break;
    private class CheckBoxListener implements ActionListener
    public void actionPerformed(ActionEvent e)
    JCheckBox checkBox = (JCheckBox)e.getSource();
    if(checkBox == sizeCheck)
    sdp.setSizeFlag(sizeCheck.isSelected());
    if(checkBox == boundsCheck)
    sdp.setBoundsFlag(boundsCheck.isSelected());

  • Change disabled JLabel text color

    Hi all
    I have some JLabels labelled black on grey color.
    When I disable them, the text color is too close to th background color to keep them readable. Is there a way to change the disabled color of the text to keep it dark enough to be read?
    Thanks

    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    public class Test {
        public static void main(String[] args) {
             UIDefaults uid = UIManager.getLookAndFeelDefaults();
             for(Iterator i = uid.keySet().iterator(); i.hasNext(); ) {
                 String key = (String) i.next();
                 if (key.startsWith("Label"))
                    System.out.println(key);
             UIManager.put("Label.disabledForeground", new Color(0x80, 0x40, 0));
             JPanel contentPane = new JPanel();
             JLabel label1 = new JLabel("This one is enabled");
             label1.setOpaque(true);
             contentPane.add(label1);
             JLabel label2 = new JLabel("This one is disabled");
             label2.setOpaque(true);
             label2.setEnabled(false);
             contentPane.add(label2);
             final JFrame f = new JFrame();
             f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             f.setContentPane(contentPane);
             f.pack();
             SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • Text Color in disabled text field

    Hi,
    In our application, The default rendered text in disabled fields is not visible properly. In order to improve the visibility we applied different color using content style for those fields.
    We did see the change in the fields after applying content-style. But it is a painful job to apply the content-style for each input field.
    Is there a way to configure default text color in ADF which is applicable for all the disabled fields in the application?
    We also tried the option of setting the color using css in following manner:
    af|inputText::content{color:#333333;}
    But this didn't have any impact on the text color.
    Please let us know if we can achieve this through a single point fix in the code.
    Thanks
    Ravi

    Hi Dimitar,
    The :rtl is a special case, as is :ltr and :alias. These are always placed at the end and are purely for the engine, they do not generate any style class on the DOM whereas other peudo classes generate a p_AF<state> class on the MAIN DOM element, which is why you must place the class on them. For example:
    af|inputText:disabled::content becomes
    In the CSS: af_inputText.p_AFDisabled af_inputText_content
    In the HTML <span class="af_inputText p_AFDisabled"><input class="af_inputText_content">
    Regards,
    ~ Simon

  • How do I change the text color of footers on select pages? (InDesign CS6)

    Good afternoon,
    Months ago, I worked with a graphic designer to put together a 100-page workbook for my training company. He turned all of the files over to me and I'd like to make a small change before we print another run for a new client. Specifically, I'm having trouble changing the text color on select pages. Since a picture says 1,000 words, let me give you an example:
    As you can see, the copyright information on the right side of the page is difficult to read here when placed over the photo (you may have to look closely, but it's along the guy's sleeve). What I'd love to do is change that part of the footer (not the left, page number side) to white text. This would make it quite a bit easier to read. There's a number of other pages in the book that I want to make this change to. I'm not sure why I never noticed it or mentioned it to the designer. I suppose I've become more discerning since then.
    Let me tell you what I've tried to do:
    I learned how to override master pages by CTRL+SHIFT clicking on the footer. However, this has not worked for me. It allows me to change the page number part, but not the copyright side. Additionally, sometimes when I override the master the formatting of the footer goes goofy. For instance, the left side and right side come together and end up in the middle of the page I'm working on.
    I'm looking for a quick way to go through and make the footers easier to read on pages where they are backed by a photo. Hoping you can help me. Please let me know if you need any other information.
    Best,
    Taylor

    I think you should have left it as it was. It seems like what you had was single pages flowing as spreads within InDesign. Like below. That is the correct way, and when you changed it to all single, it did create your footer problems.
    Will you be sending the file as a PDF to your online printer? If so, then leaving the InDesign file set as below is fine. The PDF output will separate the pages.
    All you have to do is make sure that Pages, not Spreads, is chosen when you output the PDF

  • Different text color options?

    What is the difference between changing text color through the drop-down color swatch options and the recolor artwork option?

    Under what circumstances?

Maybe you are looking for

  • Cancellation of Auto Renewal

    How do I cancel the auto renewal of photoshop? Thank you

  • R12 Accounts Payable Manager

    Hi, I am using Oracle R12 Accounts Payable Manager.  Currently when a payment is made to our suppliers a remittance file is produced in PDF format.  I would still like to have this but at the same time I would really like to be able to set up e-mail

  • How does one clean out the trash, after putting in a time line file in?

    After cleaning out some old files, it was late one night that I put a old file from the Time Line into the trash.  Now how can this be FIXED?

  • Oracle Portal Registry

    Hi, Does anyone know if there is such a thing as Portal registry? Like for example when you register an Oracle Report, what date the registration took place. I can find such things as the modified date and by, but I can't seem to find the registered

  • Integrating Flash/Flex help...

    I would like to include the Flash v3 component help files in Flex Builder 3's help structure. Is this possible?