Changing the color of a single field in a row of a table

Is it possible to change the color of text of a single field within a single column. If field 'C' in a row is negative number change the text color to red. Is this possible?

Hi Champion,
Please Do search before posting.. you get lots of threads here...
Re: color for a particular column in table
Re: Color a table row
Please go through this..
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/707fb792-c181-2d10-61bd-ce15d58b5cf1?QuickLink=index&overridelayout=true

Similar Messages

  • How do I change the background of a single cell or a row in a table?

    How do I change the background of a single cell or a row in a
    table? I doesn't seem to be letting me do that.

    Are you using the latest DW? If so, then it isn't letting you
    because
    bgcolor is deprecated and shouldn't be used.
    The correct way is to use css to define the background of a
    cell
    CSS:
    .blackcell {background-color: black;}
    HTML:
    <td class="blackcell">whatever in the cell</td>
    Nadia
    Adobe® Community Expert : Dreamweaver
    CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    ~ Template Customization ~
    http://www.csstemplates.com.au
    Spry Widget Examples
    http://www.dreamweaverresources.com/spry-widgets/
    "dm25" <[email protected]> wrote in message
    news:f4jr5h$luu$[email protected]..
    > for some reason that doesn't always work. When I click
    inside a cell, it
    > doesn't give me an option to change the background
    color.

  • Trying to change the color of a single cell

    hi, I am trying to change the color of a single cell when mouse moves over it, but couldn't do it. i even tried my own renderer, but it doesn't work. can anybody help ?

    Here is what I am trying to do. I am displaying some data in a java JTable retrieved from a table in database. What is needed is when user moves his mouse over any cell in the third column, the cursor should change to hand cursor and possibly the background color should also change, to indicate the user that this cell is clickable. I have to show some other report when user clicks any cell in column three. The code follows as
    import java.awt.*;
    import java.sql.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.sql.rowset.*;
    import javax.swing.table.*;
    public class MouseMotionInTable extends JFrame
    public static void main(String[] args)
      MouseMotionInTable f = new MouseMotionInTable();
      Toolkit tk = Toolkit.getDefaultToolkit();
      Dimension dim = tk.getScreenSize();
      int w = dim.width;
      int h = dim.height;
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setBounds((w-600)/2, (h-300)/2, 600, 300);
      f.setVisible(true);
    MouseMotionInTable()
      Connection con = null;
      CachedRowSet crs = null;
      try
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       con = DriverManager.getConnection("jdbc:odbc:FMS", "", "");
       Statement st = con.createStatement();
       String query = "SELECT ItemName, Alias, ItemReOrderQuty, ItemMeasure FROM ItemInfo";
       ResultSet rs = st.executeQuery(query);
       crs = new com.sun.rowset.CachedRowSetImpl();
       crs.populate(rs);
       st.close();
      catch (SQLException e)
       e.printStackTrace();
      catch (ClassNotFoundException e)
       e.printStackTrace();
      finally
       if(con != null)
        try
         con.close();
        catch (SQLException e)
         e.printStackTrace();
      DBTableModel model = new DBTableModel(crs);
      table = new JTable(model);
      JPanel center = new JPanel();
      center.setLayout(new BorderLayout());
      center.add(new JScrollPane(table), BorderLayout.CENTER);
      add(center, BorderLayout.CENTER);
      table.addMouseMotionListener(new MouseMotionAdapter()
       public void mouseMoved(MouseEvent me)
        int col = table.columnAtPoint(new Point(me.getX(), me.getY()));
        int row = table.rowAtPoint(new Point(me.getX(), me.getY()));
        if(col == 2)
         Object val = table.getValueAt(row, col);
         boolean isSelect = table.isCellSelected(row, col);
         boolean focus = table.isCellSelected(row, col);
         TableCellRenderer cellRender = table.getCellRenderer(row, col);
         Component comp = cellRender.getTableCellRendererComponent(table, val, isSelect, focus, row, col);
         comp.setCursor(new Cursor(Cursor.HAND_CURSOR));
         comp.setBackground(Color.yellow);
    private JTable table;
    class DBTableModel extends AbstractTableModel
    ResultSet rs;
    ResultSetMetaData rsMeta;
    DBTableModel(ResultSet rs)
      try
       this.rs = rs;
       rsMeta = rs.getMetaData();
      catch(SQLException e)
       e.printStackTrace();
    public int getColumnCount()
      try
       return rsMeta.getColumnCount();  
      catch(SQLException e)
       e.printStackTrace();
      return -1;
    public String getColumnName(int c)
      try
       return rsMeta.getColumnName(c+1);
      catch(SQLException e)
       e.printStackTrace();
      return "";
    public int getRowCount()
      try
       rs.last();
       return rs.getRow();
      catch(SQLException e)
       e.printStackTrace();
      return -1;
    public Object getValueAt(int r, int c)
      try
       rs.absolute(r+1);
       return rs.getObject(c+1);
      catch(SQLException e)
       e.printStackTrace();
      return "";
    public boolean isCellEditable(int r, int c)
      return false;
    public Class getColumnClass(int c)
      return getValueAt(0,c).getClass();
    }

  • Changing the size of a single field in runtime in table view

    Is it possible to change the row height to fit the entire text into the field for the column Exception text ?
    Is it possible to change the row height of the field exception text in run time, based on the amount of text it carries ??
    Please suggest.

    Hello,
    you can try to put the code similar to the one below in table iterator.
    METHOD if_htmlb_tableview_iterator~render_cell_start.
      DATA: lr_input TYPE REF TO cl_thtmlb_inputfield,
            lr_text TYPE REF TO cl_thtmlb_textview.
      IF p_column_key EQ 'ZLIKEATTRS'.
        lr_input ?= p_replacement_bee.
        lr_input->encode = abap_false.
        IF ( lr_input->disabled EQ 'TRUE' ) OR ( lr_input->disabled EQ abap_true )
          OR ( p_edit_mode IS INITIAL ).
    * --> input is readonly, instead of disabled input render text
          CREATE OBJECT lr_text.
          lr_text->id        = p_cell_id.
          lr_text->text      = lr_input->value.
          lr_text->_text     = lr_input->_value.
          lr_text->type      = lr_input->type.
          lr_text->_type     = lr_input->_value.
          lr_text->tooltip   = lr_input->tooltip.
          lr_text->align     = lr_input->alignment.
          lr_text->textdirection = lr_input->textdirection.
          lr_text->design    = 'VALUE'.                         "#EC NOTEXT
          lr_text->size      = lr_input->size.
          lr_text->width     = lr_input->width.
          IF lr_text->tooltip IS INITIAL.
            IF lr_input->_value IS NOT INITIAL.
              lr_text->_tooltip = lr_input->_value.
            ELSE.
              lr_text->tooltip = lr_input->value.
            ENDIF.
          ENDIF.
          lr_text->encode = abap_false.
          p_replacement_bee ?= lr_text.
        ENDIF.
      ENDIF.
    ENDMETHOD.
    In get method of your description column split the text into lines using <br> tag.
    Something like this:
    LOOP AT lt_attrs INTO lv_attr.
            CONCATENATE lv_value '<br>' lv_attr INTO lv_value.
        ENDLOOP.

  • How can I change the color of a single object?

    I have a bright orange barrel in a video of mine and I want to change it to a cooler color without changing the rest of the scene? How can I do this?

    Hi
    In FCP, under the help menu, choose Final Cut Pro Help.
    When it opens, search for " Using the Limit Effect Controls of the Color Corrector Filter to Change a Specific Color".
    MtD

  • Change the color of a particular row in a jtable

    I have a jtable and i want to change the color of one particular column and few rows to blue and underline the text depending on some condition. In my view class if a condition is true
    for( count=0;count<grdTest.getRowcount;count++)
    if(some condition true)
    grdTest.getColumnModel().getColumn(0).
    setCellRenderer(new MyTestCellRenderer(count));
    And my cell renderer
    public class MyTestCellRenderer extends DefaultTableCellRenderer {
    int rowIndex=-1;
    public MyTestCellRenderer(int rowcount) {
    super();
    rowIndex=rowcount;
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value,
    isSelected, hasFocus, row, column);
    if(row == rowIndex)
    setText("<html> <u> <font color='blue'>" + value.toString());
    return this;
    This is behaving very wierd . If suppose there are 50 rows and all of them have the condition true then only the last one in the row color is changes.
    However if only one out othe say10 has the condition true then it changes the color and underlines the particular row,column.
    Is there any other way to do this or what i am doing wrong
    Thanks

    if(row == rowIndex)Your code is a shambles because of the lack of tags, but I don't believe I see anything being called when this boolean condition is not true. That would be a problem.                                                                                                                                                                                                                                                                                                                                                                                                           

  • Tabular Forms - how to change the color of text when the field is disabled

    Hi,
    I have a tabular form and some of it's columns are disabled showing text in grey color...
    is there a way to change the color to black and bold the text...?
    thanks

    Okay, i've taken a look at your example.
    The column formatting does not work on the input fields. The help on the item says that it generates a span with a style attribute. This would work for a display field, not for an input field.
    Css like i've written should be in the style tags, put up in the header section of the page (page -> edit -> header region).
    You've already put script tags there, the style tags go there aswell. You shouldn't even need to put your script tags in the header region. Just put your code up in the javascript functions region (without the script tags).
    However, i tested in firefox and here color works on an input field, changing the font color. In IE it does not do this. Cross browser implementations and such, not much to do about it here. See http://stackoverflow.com/questions/602070/changing-font-colour-in-textboxes-in-ie-which-are-disabled.
    I did notice that you build your form with a bunch of input fields, which you disable through javascript in the footer of the region. Then on submit, you set the disabled to false again for all those fields! If you want those fields to always be submitted to the server, why wouldn't you use the readonly attribute? Readonly fields are always submitted, and can't be edited by the user. Plus, readonly fields CAN be styled however you want! You can get rid of the javascript code in your header then.
    Even the javascript in the footer is not necessary. If you just add 'readonly="true"' (without single quotes) to the element attributes of your items (edit column -> column attributes region) = no javascript at all (less maintenance).

  • How can i change the color of a field in a table depence of a value

    Hi forum
          Is this possible to change the color of a row in a specific field of a table depends of the value of this field,,, for example if the value is equal or greather than 1.
    Thnks
    Josué Cruz

    Josue,
    Yes this is possible if you use the fillColor method. It requires R,G,B value of color.
    //Sample code which highlights cell2 in my table which has two rows.
    frm1.Table1.Row2.Cell2.fillColor = "120,120,120";
    // If you want highlight complete row.
    frm1.Table1.Row2.fillColor = "120,120,120";
    So now just apply an if loop which reads the input value as greater than 1 and use the code shown above.
    Chintan

  • When creating a fillable form and saving it as a pdf, the default color of the data fields is a light blue. How do I change the color to something else that will copy better, e.g. a light yellow?

    When creating a fillable form and saving it as a pdf, the default color of the data fields is a light blue. How do I change the color to something else that will copy better, e.g. a light yellow?

    It's probably the fields highlight color of the application, which you can change via Edit - Preferences - Forms.

  • How to change the color of the text field of form

    Hi ,
    Is there any way to change the color of the text field of the form........
    Thnx in advance .......
    Cheers,
    Eman

    Hi Bob. I'm new to these forums and I'm not sure of protocol and exactly how this is supposed to work, so If I'm doing this wrong then please excuse me and let me know.
    I liked you solution on 'How to change the color of an Item on a form' using <blink>.
    I'm new to this application and coding as well so its kind of foreign to me.
    Working on a Report Page,
    I would like to have item, :P1_JOB_NO blink when the difference between sysdate and :P1_DATE_DUE < 7 days.
    I can identify the job_no which should blink by using the sql statement:
    SQL> select job_no from oax_projects07 where
    2 (sysdate - date_due < 7) and
    3 emp_name = 'GARY PILKENTON';
    JOB_NO
    20060627 050
    But I dont know the proper syntax to make it blink,
    or when to plug the syntax into.
    ie, is it a process, a validation, etc.
    Do you have any advice for me?

  • Is it possible to change the color of the text in one specific field?

    If I want to make someone's mobile number show up as the primary contact, is it possible to make the text for that number a different color or make it bold? I can't seem to find a way to do it.
    Thanks.

    Make a Shape > Inspector > Graphic > Tinted Image Fill > Scale to fit > browse to image > click on the color patch to change the color to what you want
    or
    Drag in an image > overlay it with a Shape > select the color for the shape and change its Opacity
    Shapes may have Gradient and Advanced Gradient (multiple colors) fills both linear and radial. Both are in the Graphic Inspector as is Opacity.
    Peter

  • 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
    --

  • How to change the color (or fill) of a SINGLE bar in a bar chart series

    I've searched the forum and consulted the help system in Keynote '09, and I can't find the answer.
    I have a simple bar chart with 6 bars. I want to select two of the bars and turn them a different color. I only seem to be able to change the color of the series as a whole. I can only select the series as a whole, and I can't Ungroup it or even copy it to the clipboard (it beeps!). I've tried changing the color of the number represented by the bar in the underlying table; can't be done.
    Am I attempting something impossible? If so (grumble grumble), why hasn't Apple made it possible? It seems like an obvious thing to allow.

    It is unfortunately impossible -- the individual bars are not selectable. As a workaround you can a) overlay them with a rectangular object, or b) overlay them with a second chart identical to the first, with all the bars except the two set to zero.

  • Changing the color of text while mouse listener.

    Hi all. working on an assignment for school and I need a little hint.
    I am creating an applet to basically input names in txt blocks, and then you hit a button that will move the names to a text area. Well the instructor asked us to use a mouse listener to change the color of the labels on the txt blocks. Basically when you hover your mouse over the button it is supposed to change the color of the button (for and back ground), and change the color of the labels on the txt blocks.
    I just did a general setForground(color.blue);
    for my labels default color and it seemed to do the trick, I used the following code to try to change the color of both the buttons and the txt block labels, but only the button works.
    Please assist..
    public class Assignment2 extends java.applet.Applet implements ActionListener, MouseListener {
    public void mouseExited(MouseEvent e){
    //Colors Back
    setForeground(Color.blue);
    btnAdd.setForeground(Color.red);
    btnAdd.setBackground(Color.yellow);
    //Clear Status bar
    showStatus("");
    public void mouseClicked(MouseEvent e) {
    //empty Method
    public void mousePressed(MouseEvent e){
    //empty method
    public void mouseReleased(MouseEvent e){
    //empty method

    HI,
    Sorry for delay. I was not on my seat.
    I've modified your code and the label colors are changing now on the mouse over or out events.
    I did this only for a single label i.e. "First Name". Just have a look on the code and do the same for the rest labels.
    If u feel any problem, then revert to me.
    Bye
    (Dhananjay Singh)
    Here's Your Code
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ColorText extends java.applet.Applet implements ActionListener, MouseListener {
        //Declare components
        TextField txtName = new TextField(25);
        TextField txtLast = new TextField(25);
        TextField txtAdd = new TextField(30);
        TextField txtCity = new TextField(15);
        TextField txtState = new TextField(2);
        TextField txtZip = new TextField(10);
        Label fName = null;
        Label lName = null;
        Label address = null;
        Label citi = null;
        Label state = null;
        Label zip = null;
        Button btnAdd = new Button("Display Address");
        TextArea txaAdd = new TextArea(10, 30);
        //Declare variables
        String strName;
        String strLast;
        String strAdd;
        String strCity;
        String strState;
        String strZip;
        public void init() {
            //Create labels
            fName = new Label("First Name");
            lName = new Label("Last Name");
            address = new Label("Address");
            citi = new Label("City");
            state = new Label("State");
            zip = new Label("Zip");
            fName.addMouseListener(new MouseListener() {
                public void mouseEntered(MouseEvent e) {
                    fName.setBackground(Color.RED);
                public void mouseClicked(MouseEvent e) {
                public void mouseExited(MouseEvent e) {
                    fName.setBackground(Color.YELLOW);
                public void mousePressed(MouseEvent e) {
                public void mouseReleased(MouseEvent e) {
            setForeground(Color.blue);
            Font g = new Font("Serif", Font.BOLD, 14);
            setFont(g);
            add(fName);
            add(txtName);
            add(lName);
            add(txtLast);
            add(address);
            add(txtAdd);
            add(citi);
            add(txtCity);
            add(state);
            add(txtState);
            add(zip);
            add(txtZip);
            add(btnAdd);
            add(txaAdd);
            txtName.requestFocus();
            //Colors and Fonts
            Font fntName = new Font("Serif", Font.BOLD, 14);
            setBackground(Color.lightGray);
            txtName.setFont(fntName);
            txtName.setForeground(Color.blue);
            txtAdd.setFont(fntName);
            txtAdd.setForeground(Color.blue);
            txtLast.setFont(fntName);
            txtLast.setForeground(Color.blue);
            txtCity.setFont(fntName);
            txtCity.setForeground(Color.blue);
            txtState.setFont(fntName);
            txtState.setForeground(Color.blue);
            txtZip.setFont(fntName);
            txtZip.setForeground(Color.blue);
            btnAdd.setForeground(Color.RED);
            btnAdd.setBackground(Color.yellow);
            //listeners
            btnAdd.addActionListener(this);
            txtName.addActionListener(this);
            txtLast.addActionListener(this);
            txtAdd.addActionListener(this);
            txtCity.addActionListener(this);
            txtState.addActionListener(this);
            txtZip.addActionListener(this);
            btnAdd.addMouseListener(this);
        public void actionPerformed(ActionEvent e) {
            //Actions
            String strOutputLine; //Declare local variable
            //Assign text fields
            strName = txtName.getText();
            strLast = txtLast.getText();
            strAdd = txtAdd.getText();
            strCity = txtCity.getText();
            strState = txtState.getText();
            strZip = txtZip.getText();
            //Move variables down
            strOutputLine = strName + ("\n") + strLast + ("\n") + strAdd + ("\n") + strCity + ("\n") + strState + ("\n") + strZip + ("\n") + ("\n") ;
            //Append
            txaAdd.append(strOutputLine);
            //Clear Text Fields
            txtName.setText("");
            txtLast.setText("");
            txtAdd.setText("");
            txtCity.setText("");
            txtState.setText("");
            txtZip.setText("");
            //set focus back to Lastname
            txtName.requestFocus();
        public void mouseEntered(MouseEvent e) {
            // Changing of Button colors
            setForeground(Color.red);
            btnAdd.setForeground(Color.magenta);
            btnAdd.setBackground(Color.green);
            //Status bar text
            showStatus("Format Address into Text Area");
        public void mouseExited(MouseEvent e){
            //Colors Back
            setForeground(Color.blue);
            btnAdd.setForeground(Color.red);
            btnAdd.setBackground(Color.yellow);
            //Clear Status bar
            showStatus("");
        public void mouseClicked(MouseEvent e) {
            //empty Method
        public void mousePressed(MouseEvent e){
            //empty method
        public void mouseReleased(MouseEvent e){
            //empty method
    }(Dhananjay Singh)

  • Changing the background of a text field in adobe interactive forms

    Hello All,
    Is there any way to change the background colour of text field in interactive form dynamically.??
    Thanks,

    Naresh,
    Change the language to JavaScipt in Script Editor of LiveCycle Designer and use the following code to highlight the area of TextField where R,G,B means that you have to give the RGB values of the color you want.
    <YourTextFieldName>.border.edge.color.value = "R,G,B";
    For eg:- If you have a textfield with name TextField1 then this will highlight the TextField1 area in red color.
    if ((TextField1.rawValue==null) || (TextField1.rawValue==""))
      TextField1.border.edge.color.value = "255,0,0";
    You can use this on exit event of Textfield1 or at the submit button where you check the form data.
    Chintan

Maybe you are looking for

  • Power Mac G4 Digital Audio Electrical Problem?

    My G4 has recently begun making a 'whinning' noise. I thought it was the hard drive going bad. I replaced the hard drive and within minutes the replacement began to hum [squeeech?] like the first. I obtained a replacement drive and within an hour the

  • A browser for QT files ?

    I have been acumulating thousands of QuickTime files due to the necessity I have of transcoding AVCHD clips into QT files that I can work with -I do this with the Voltaic software - as I am a G5 PowerPC/Final Cut Studio user. Is there a program that

  • MRP MD04 - message 15 Postpone the process

    Hello Experts, In md04 it is falling into exception and postponing the planned lead time to  open sales order.... we want delivery date as per planned lead time ...i guess system is considering dependant requirements and pushing date to open sales or

  • How to change the displayed name of a DefaultMutableTreeNode

    Hi there... I created a class A extending DefaultMutableTreeNode and A's constructor is as follows: public A(UserObject object) { setUserObject(object); so my problem is if I wanna add such an instance of A, in a tree (as a node) the displayed name i

  • X Steps in Discreet manufacturing in Production order scenario

    Hi XSTEPS guru's As i understand till now XSTEPS is posible in PP-PI however in one thread i saw it is mentioned its application for  Discreet manufactring too.I will like to know is it really possible to apply XSTPES in discreet production order sce