Changing Row Color In JTable !

Hi friends
I have two JTables. The first one has 7 columns and 10 rows (with data) but the second one is empty.
The user can choose one row from first table and by pressing the ((copy)) button , copy that row to the second table. Is it possible to change the color of those rows(in the first table) that been copied to the second table. I mean if the user choose a row and copy then to the second table, the color of this row wold be changed.
Can anybody help me with that??
Thanks

I think you are heading in the wrong direction here... you want to create a brand new DefaultTableCellRenderer and override the getTableCellRendererComponent method...
public class MyRenderer extends DefaultTableCellRenderer {
  public Component getTableCellRendererComponent(JTable table, Object value,
                          boolean isSelected, boolean hasFocus, int row, int column) {
              JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
                           row, column);
              //now I can change the background color depending on the row...
              if (row == xxx) lbl.setBackground(Color.red);
}Then use your new class on your table...
<table.setDefaultRenderer(Object.class, new MyRenderer()); //the class must match what you TableModel returns for getColumnClass();Hope this helps,
Josh Castagno
http://www.jdc-software.com
Hope this helps

Similar Messages

  • Change  row color on alv

    hi
    how can i change row color on alv.

    Hi
    thanks your answer  Uday Gubbala         
    i was examinated this link  [https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abapWebDynproALV-ChangeCellColourbasedonContent]
    but i don't  do   this row  wd_this->m_alv_model = lo_value. error message : m_alv_model unknow.
    and this sample change column color but i want to row
    Thanks.

  • Re: Is it possible to change row colors on array fields ors

    HI Martin!
    Yes, it is possible to change row colors on array fields.
    I have attached a PEX (tools.pex) which has an object which changes FillColor
    and PenColor for Arrays. The PEX has it's own test window, so you can try
    various combinations. (There are a few other Objects in the Project which are
    not relevant
    I'm not sure that you can change colors on individual choices in a scroll list.
    I haven't tried playing around with it.
    The test window actually changes the color of scroll lists as well.
    The object keeps track of which rows have changed color, same with pen color, so
    that when you scroll it keeps track of which rows are a different colors.
    The pex is self-contained, just import the file and do a test run.
    Please let me know if you have any problems.
    -later
    -labeaux
    Is it possible to change row colors on array fields or scroll lists?
    I need to create a list field that will allow me to dynamically change the
    fillColor and/or penColor attributes of individual rows. (I just want to
    highlight the rows, and those seem to be the obvious attributes...) It appears
    you can't do that on scroll lists (the elements are list elements, and don't
    have those attributes) and I can't figure out how to do it on an array field
    either. Any ideas for how to accomplish this?
    -Martin ([email protected])

    FreshWebmuse,
    Version 2 of iCal has the "Group Calendar" feature. It was released as part of Mac OS X v10.4, and if you really want/need that feature you will have to upgrade to Tiger.
    ;~)

  • Changing background color in JTable, only changes one row at a time...

    I'm trying to change the color of rows when the 5th column meets certain criteria. I think I'm very close, but I've hit a wall.
    What's happening is the row will change color as intended when the text in the 5th column is "KEY WORD", but when I type "KEY WORD" in a different column it will set the first row back to the regular colors. I can easily see why it's doing this, everytime something is changed it rerenders every cell, and the listener only checks the cell that was just changed if it met the "KEY WORD" condition, so it sets every cell (including the previous row that still meets the condition) to the normal colors. I can't come up with a good approach to changing the color for ALL rows that meet the condition. Any help would be appreciated.
    In this part of the CellRenderer:
            if (isSelected)
                color = Color.red;
            else
                color = Color.blue;
            if (hasFocus)
                color = Color.yellow;
            //row that meets special conditions
            if(row == specRow && col == specCol)
                color = color.white; I was thinking an approach would be to set them to their current color except for the one that meets special conditions, but the two problems with that are I can't figure out how to getColor() from the table, and I'm not sure how I would initially set the colors.
    Here's the rest of the relevant code:
        public void tableChanged(TableModelEvent e)
            int firstRow = e.getFirstRow();
            int lastRow  = e.getLastRow();
            int colIndex = e.getColumn();
            if(colIndex == 4)
                String value = (String)centerTable.getValueAt(firstRow, colIndex);
                // check for our special selection criteria
                if(value.equals("KEY WORD"))
                    for(int j = 0; j < centerTable.getColumnCount(); j++)
                        CellRenderer renderer =
                            (CellRenderer)centerTable.getCellRenderer(firstRow, j);
                        renderer.setSpecialSelection(firstRow, j);
    import javax.swing.table.*;
    import javax.swing.*;
    import java.awt.Component;
    import java.awt.Color;
    public class CellRenderer extends DefaultTableCellRenderer
        int specRow, specCol;
        public CellRenderer()
            specRow = -1;
            specCol = -1;
        public Component getTableCellRendererComponent(JTable table,
                                                       Object value,
                                                       boolean isSelected,
                                                       boolean hasFocus,
                                                       int row, int col)
            setHorizontalAlignment(JLabel.CENTER);
            Color color = Color.green;
            if (isSelected)
                color = Color.red;
            else
                color = Color.blue;
            if (hasFocus)
                color = Color.yellow;
            if(row == specRow && col == specCol)
                color = color.white;
            //setForeground(color);
            setBackground(color);
            setText((String)value);
            return this;
        public void setSpecialSelection(int row, int col)
            specRow = row;
            specCol = col;
    }If I'm still stuck and more of my code is needed, I'll put together a smaller program that will isolate the problem tomorrow.

    That worked perfectly for what I was trying to do, but I've run into another problem. I'd like to change the row height when the conditions are met. What I discovered is that this creates an infinite loop since the resizing triggers the renderer, which resizes the row again, etc,. What would be the proper way to do this?
    Here's the modified code from the program given in the link. All I did was declare the table for the class, and modify the if so I could add the "table.setRowHeight(row, 30);" line.
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    public class TableRowRenderingTip extends JPanel
        JTable table;
        public TableRowRenderingTip()
            Object[] columnNames = {"Type", "Company", "Shares", "Price", "Boolean"};
            Object[][] data =
                {"Buy", "IBM", new Integer(1000), new Double(80.5), Boolean.TRUE},
                {"Sell", "Dell", new Integer(2000), new Double(6.25), Boolean.FALSE},
                {"Short Sell", "Apple", new Integer(3000), new Double(7.35), Boolean.TRUE},
                {"Buy", "MicroSoft", new Integer(4000), new Double(27.50), Boolean.FALSE},
                {"Short Sell", "Cisco", new Integer(5000), new Double(20), Boolean.TRUE}
            DefaultTableModel model = new DefaultTableModel(data, columnNames)
                public Class getColumnClass(int column)
                    return getValueAt(0, column).getClass();
            JTabbedPane tabbedPane = new JTabbedPane();
            tabbedPane.addTab("Alternating", createAlternating(model));
            tabbedPane.addTab("Border", createBorder(model));
            tabbedPane.addTab("Data", createData(model));
            add( tabbedPane );
        private JComponent createAlternating(DefaultTableModel model)
            JTable table = new JTable( model )
                public Component prepareRenderer(TableCellRenderer renderer, int row, int column)
                    Component c = super.prepareRenderer(renderer, row, column);
                    //  Alternate row color
                    if (!isRowSelected(row))
                        c.setBackground(row % 2 == 0 ? getBackground() : Color.LIGHT_GRAY);
                    return c;
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            table.changeSelection(0, 0, false, false);
            return new JScrollPane( table );
        private JComponent createBorder(DefaultTableModel model)
            JTable table = new JTable( model )
                private Border outside = new MatteBorder(1, 0, 1, 0, Color.RED);
                private Border inside = new EmptyBorder(0, 1, 0, 1);
                private Border highlight = new CompoundBorder(outside, inside);
                public Component prepareRenderer(TableCellRenderer renderer, int row, int column)
                    Component c = super.prepareRenderer(renderer, row, column);
                    JComponent jc = (JComponent)c;
                    // Add a border to the selected row
                    if (isRowSelected(row))
                        jc.setBorder( highlight );
                    return c;
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            table.changeSelection(0, 0, false, false);
            return new JScrollPane( table );
        public JComponent createData(DefaultTableModel model)
            table = new JTable( model )
                public Component prepareRenderer(TableCellRenderer renderer, int row, int column)
                    Component c = super.prepareRenderer(renderer, row, column);
                    //  Color row based on a cell value
                    if (!isRowSelected(row))
                        c.setBackground(getBackground());
                        String type = (String)getModel().getValueAt(row, 0);
                        if ("Buy".equals(type)) {
                            table.setRowHeight(row, 30);
                            c.setBackground(Color.GREEN);
                        if ("Sell".equals(type)) c.setBackground(Color.YELLOW);
                    return c;
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            table.changeSelection(0, 0, false, false);
            return new JScrollPane( table );
        public static void main(String[] args)
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
        public static void createAndShowGUI()
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("Table Row Rendering");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add( new TableRowRenderingTip() );
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    }Edited by: scavok on Apr 26, 2010 6:43 PM

  • Change Cell Color of JTable-Please Help

    Hi All,
    I want to change the color of a Row in a JTable when i click on it. And After that when i click another row i want to retain this color and give another color to the second row.
    If somebody knows how to do this. Do Help
    Thanks in advance
    -Jeena

    Hi,
    thanks for the fast reply
    Using a TableCellRenderer i was able to give colors to the selected row. But when i click another row the color disappears.
    Thanks,
    Jeena

  • Change row color

    I am developing an application using Oracle 6i Forms and Developer,and i am new to it.
    I have a datablock on a canvas and i am trying to do sth:
    When the user clicks on a row of the datablock,the entire row background color should change to green and all the other rows to color grey.
    What trigger should i use to make this?
    Thanks

    Indeed,
    The block level will also change the color of buttons.
    In case of the rest of rows gray, what you can do is by default set the background color to gray and override it with the current record visual attribute at block or item level.
    Regards,
    Tony
    PS: You can also use the CURRENT_RECORD_ROW_BACKGROUND_COLOR to set the background color of the selected row.
    Message was edited by:
    Tony Garabedian

  • 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

  • Alternating row colors in JTable

    hi everybody,
    Can anyone tell me how i can change the colour of every other row in my JTable?
    Thanks
    Ivor

    Yes,
    using a TableCellRenderer. look at:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#custom
    Phil

  • Changing Row color of standard SQL report

    Hi,
    I am trying to follow this post to change the color of a row in APEX SQL report. Change Colour of Row - Oracle APEX SQL Report
    It's a bit outdated, and trying to figure out how to get to this page: http://img7.imageshack.us/img7/4782/columntemplate.jpg in APEX 4.2 where I can conditionally set background color.
    I am using theme 13 (legacy) and made a copy of the report region. Edited it but cannot find an equivalent section of that apex 3.1 screenshot.
    Any help appreciated.

    William Wallace wrote:
    I sure was :) Cheers for pointing it out.
    Just another question, there are 4 options for the #COLUMN_VALUE# which I have background color conditionally (just like in that screenshot) based on one of the column values. The column can be of 1..5 values, however I only have 4 conditions to work with in the template editor.
    So what APEX is doing is since it can't find a 5th matching condition, it picks the very first one and applies it on it (even though the condition doesn't match).
    Is there anyway I can incorporate a 5th option/condition for column templates? Cheers.Not using that technique. There are a couple of options: another template-based approach using a custom named column report template, or using jQuery. I generally prefer the template method as everything runs on the server.
    1. Start by including a column containing the condition logic to generate a class value in the report query:
    select
            , case
                when sal < 1000 then 'low'
                when sal between 1000 and 2000 then 'medium'
                when sal > 2000 then 'high'
              end sal_class
    from
              empThen create a custom named column report template:
    2. Go to: Shared Components > Templates > Create
    3. In the wizard select: Report > From Scratch
    4. Enter/select:
    Name: [Name for this template]
    Theme: [Your current theme]
    Template Class: Custom 1
    Template Type: Named Column (row template)
    5. Click Create.
    6. Click the Status Report link in the Templates report.
    7. Enter the following properties:
    Row Template 1
    <tr class="#SAL_CLASS#"><td>#1#</td><td>#2#</td>...include a cell with a column substitution for every column in your report...</tr>i.e. the column with the conditional logic in the query is used to apply the required class to the row.
    Before Rows
    <!-- Copy the Before Rows definition from the Standard report template for your current theme and paste here -->
    <tr><th>#1#</th><th>#2#</th>...include a header with a column substitution for every column in your report...</tr>
    After Rows
    <!-- Copy the After Rows definition from the Standard report template for your current theme and paste here -->Add CSS to style the rows:
    8. Edit the Page CSS Attributes for the report page:
    Inline
    tr.low td { background-color: yellow; }
    tr.medium td { background-color: white; }
    tr.high td { background-color: red; }9. Change the report to use the new template.
    For the alternative jQuery approach, Tom created an example for this thread: +{thread:id=2487955}+

  • Changing row color through a drop down box????

    Is there a way I can get a table row to change color based on the value of a drop down box? I have 3 color options in the drop down list: yellow, green, red. I'm trying to get it so when I select a color in the list (like for example green) the whole row of that table fills with green. I'm searching for an answer and I can't find it. Any help would be greatly appreciated Thanks :)

    Check the code very carfully, you appear to have left off a number of quotes:
    // force to white in case there is no match following
    Page1.Shape.LeaveType.border.fill.color.value = "0,0,0";
    //changes row to red
    if(LeaveType.rawValue == 4) {
    Page1.Shape.LeaveType.border.fill.color.value = "255,0,0";
    //change row to Green
    if(LeaveType.rawValue == 3) {
    Page1.Shape.LeaveType.border.fill.color.value = "0,128,0";
    //change row to Blue
    if(LeaveType.rawValue==2) {
    Page1.Shape.LeaveType.border.fill.color.value = "0,0,255";
    //keep row white
    if(LeaveType.rawValue == 1) {
    Page1.Shape.LeaveType.border.fill.color.value = "0,0,0";
    Or you could use the "swithc(){}" statement:
    var FillColor = "0,0,0"; // white
    switch(LeaveType.rawValue) {
    case 4:
    FillColor = "255,0,0"; // red
    break;
    case 3:
    FillColor = "0,128,0"; // green
    break;
    case 2:
    FillColor = "0,0,255"; // blue
    break;
    case 1:
    break;
    default:
    app.alert("Unkown Leave Type: " + LeaveType.rawValue, 1, 1); // identify unkown leave type
    break;
    Page1.Shape.LeaveType.border.fill.color.value = FillColor;
    You might want to also open Acrobat and check the Debugging Conosole for errors.

  • Setting row color in JTable

    I am trying to display some rows in a JTable in a different color regardless of selection status. The row color criteria would be from data from the object in the row, i.e., given a certain status of a record, I would want to show it as red instead of black.

    A few optimizations:
    class StatusColorRenderer
    extends DefaultTableCellRenderer
        public StatusColorRenderer()
            // super(); not needed, call by default
            setOpaque(true);
            // DefaultTableCellRenderer returns itself as a CellRenderer Component, it extends JLabel so you can call setOpaque on it
    // since this method is called at every paint for every cell it should be HIGHLY optimized
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
        Component c = super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column);
        MyObjectClass myObject  = ( MyObjectClass ) myTableModel.getMyVector().elementAt(row);
        <SomeClass> myStatus = myObject.getTheStatus();
        if ( myStatus.compareTo(Status.BAD_STAT) == 0)
            c.setForeground(Color.red);
        else if (myStatus.compareTo(Status.IN_PROGRESS) == 0)
            c.setForeground(Color.green);
        else if ( myObject.getOtherFactor().compareTo(OtherFactors.NOT_DEFAULT) ==  0)
            c.setForeground(Color.blue);
        else
            c.setForeground(Color.black);
        // c.repaint(); NEVER DO THAT
        return c;
    StatusColorRenderer myRenderer = new StatusColorRenderer();
    // only one instance of the renderer
    for ( int i = myTableModel.getColumnCount() - 1 ; i >= 0 ; i-- )
       //column = myTable.getColumnModel().getColumn( i );
       myTable.setDefaultRenderer( myTable.getColumnClass( i ),
                                                myRenderer );
    }Comment:
    AbstractTableModel and DefaultTableModel.getColumnClass method returns Object.class, it is used by the JTable to setup the editor and the renderer of a column
    so if you're using the DefaultTableModel and JTable without overriden getColumnClass, you can set a generic renderer for your JTable by using:
    myTable.setDefaultRenderer( Object.class, myRenderer );

  • Changing row color of a report

    Apex version 4.1,
    Hi Experts,
    I have a simple report and one column holds a flag value (either 1 or 0). all the rows which has the flag value as 1 should be displayed in different color on the report. How can i do this custom row coloring ?
    Really appreciate if someone can help me on this,
    Thanks guys.
    Kurubaran.

    Apex-Ape wrote:
    Really appreciate if someone can help me on this,
    You can help yourself on this&mdash;and most other questions&mdash;by searching the forum before posting to find the numerous previous answers, such as +{thread:id=2292619}+

  • Button to change bg-color in JTable cell

    Hello!
    I would like to change the background color of a cell with a klick on a button.
    There will be 3 colors, and the selected cell are the only one thats going to change.
    How do I do that?
    Heres my code:
    import javax.swing.*;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Rectangle;
    import javax.swing.JButton;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableColumnModel;
    import javax.swing.table.TableModel;
    public class Kinna extends JFrame {
         private static final long serialVersionUID = 1L;
         private JPanel jContentPane = null;
         private JTabbedPane jTabbedPane = null;
         private JScrollPane jScrollPane = null;
         private JTable jTable = null;
         private JButton jButtonRed = null;
         private JButton jButtonGreen = null;
         private JButton jButtonBlue = null;
         private JButton jButtonNewWeek = null;
         private JButton jButtonDelWeek = null;
          * This method initializes jTabbedPane     
          * @return javax.swing.JTabbedPane     
         private JTabbedPane getJTabbedPane() {
              if (jTabbedPane == null) {
                   jTabbedPane = new JTabbedPane();
                   jTabbedPane.setBounds(new Rectangle(105, 45, 545, 488));
                   jTabbedPane.addTab(null, null, getJScrollPane(), null);
              return jTabbedPane;
          * This method initializes jScrollPane     
          * @return javax.swing.JScrollPane     
         private JScrollPane getJScrollPane() {
              if (jScrollPane == null) {
                   jScrollPane = new JScrollPane();
                   jScrollPane.setViewportView(getJTable());
              return jScrollPane;
          * This method initializes jTable     
          * @return javax.swing.JTable     
         private JTable getJTable() {
              if (jTable == null) {
                   Object[] head = {"Namn", "M�ndag", "Tisdag", "Onsdag", "Torsdag", "Fredag"};
                   Object[][] data = {{"Niklas", "9-15", "9-15", "9-15", "9-15","9-15"},
                                            {"Niklas", "9-15", "9-15", "9-15", "9-15","9-15"}};
                   jTable = new JTable(data, head);
                      // This table shades every other column yellow
              return jTable;
          * This method initializes jButtonRed     
          * @return javax.swing.JButton     
         private JButton getJButtonRed() {
              if (jButtonRed == null) {
                   jButtonRed = new JButton("R�d");
                   jButtonRed.setBounds(new Rectangle(15, 30, 76, 31));
                   jButtonRed.setText("R�d");
                   jButtonRed.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
              return jButtonRed;
          * This method initializes jButtonGreen     
          * @return javax.swing.JButton     
         private JButton getJButtonGreen() {
              if (jButtonGreen == null) {
                   jButtonGreen = new JButton("R�d");
                   jButtonGreen.setBounds(new Rectangle(15, 75, 76, 31));
                   jButtonGreen.setText("Gr�n");
              return jButtonGreen;
          * This method initializes jButtonBlue     
          * @return javax.swing.JButton     
         private JButton getJButtonBlue() {
              if (jButtonBlue == null) {
                   jButtonBlue = new JButton("R�d");
                   jButtonBlue.setBounds(new Rectangle(15, 120, 76, 31));
                   jButtonBlue.setText("Bl�");
              return jButtonBlue;
          * This method initializes jButtonNewWeek     
          * @return javax.swing.JButton     
         private JButton getJButtonNewWeek() {
              if (jButtonNewWeek == null) {
                   jButtonNewWeek = new JButton();
                   jButtonNewWeek.setBounds(new Rectangle(270, 0, 91, 31));
                   jButtonNewWeek.setText("Ny Vecka");
                   jButtonNewWeek.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                             System.out.println("actionPerformed()");
                             int i = getJTabbedPane().getSelectedIndex() + 1;
                             String tab = "Index: " + i;
                             getJTabbedPane().addTab(tab, new JLabel("Hello"));
                             getJTabbedPane().setSelectedIndex(getJTabbedPane().getTabCount()-1);
              return jButtonNewWeek;
          * This method initializes jButtonDelWeek     
          * @return javax.swing.JButton     
         private JButton getJButtonDelWeek() {
              if (jButtonDelWeek == null) {
                   jButtonDelWeek = new JButton();
                   jButtonDelWeek.setBounds(new Rectangle(375, 0, 121, 31));
                   jButtonDelWeek.setText("Ta bort vecka");
                   jButtonDelWeek.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                             System.out.println("actionPerformed()");
                             getJTabbedPane().removeTabAt(getJTabbedPane().getSelectedIndex());
              return jButtonDelWeek;
          * @param args
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        Kinna thisClass = new Kinna();
                        thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        thisClass.setVisible(true);
          * This is the default constructor
         public Kinna() {
              super();
              initialize();
          * This method initializes this
          * @return void
         private void initialize() {
              this.setSize(670, 580);
              this.setContentPane(getJContentPane());
              this.setTitle("JFrame");
          * This method initializes jContentPane
          * @return javax.swing.JPanel
         private JPanel getJContentPane() {
              if (jContentPane == null) {
                   jContentPane = new JPanel();
                   jContentPane.setLayout(null);
                   jContentPane.add(getJTabbedPane(), null);
                   jContentPane.add(getJButtonRed(), null);
                   jContentPane.add(getJButtonGreen(), null);
                   jContentPane.add(getJButtonBlue(), null);
                   jContentPane.add(getJButtonNewWeek(), null);
                   jContentPane.add(getJButtonDelWeek(), null);
              return jContentPane;
    }  //  @jve:decl-index=0:visual-constraint="29,25"

    If you have a different color for every cell in the table, then maybe it would be easier to store a custom Object in the TableModel that has two pieces of information:
    a) the text to be displayed
    b) the background color of the text.
    Then you can write a custom renderer that uses both pieces of information to renderer the cell correctly.
    Here is an untested example of what the custom renderer might look like:
    class ColorRenderer extends DefaultTableCellRenderer
         public Component getTableCellRendererComponent(
                   JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
              super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
              CustomObject custom = (CustomObject)value;
              setText( custom.getText() );
              if (!isSelected)
                   setBackground( custom.getBackground() );
              return this;
    }

  • [php+mysql] nextensio list: how to change row color based on field content?

    Hi all
    I have a nextensio list on a page.
    is there a way to change the background color of a whore row based on
    a specific field content?
    example I have a field containing the values 0 or 1.
    If the field content is 1 the row background color should be RED.
    ANy suggestion?
    TIA in advance.
    tony

    DataBoundAPI's you can refer to achieve this.
    Search for OLD threads also. Here are some links:
    Can we colour the rows in the column of a table
    Advanced table row font color- result based change.
    Thanks
    --Anil
    http://oracleanil.blogspot.com/

  • Changing row color when ever will select that row.

    Hello,
    After applying themes which property do i need to to change so that the color of the row will change from from dark yellow to some light color when ever i select that perticular record
    in table UI Element.
    Thanks & Regards
       Kiran

    Hello Kiran,
    In theme editor go to Complex Elements -> Tables -> Side Heading Selected Cells -> Background color of Primary selection.
    Hope this helps.
    Cheers-
    Pramod
    award points if helpful.

Maybe you are looking for

  • Windows compatible video card for OSX?

    I have a windows PC with an ATI All-In-Wonder 9600XT card that i put in it a few years back. I was wondering if this card is compatible with my PPC Powermac G5 Dual 2.7 machine to add on as a second video card. It's only purpose would be for me to im

  • Can not add songs to ipod

    I have a 30 gig Ipod video, and have been manually dragging songs from my library to put on it. Recently, I have not been able to add songs. When I drag songs to it, nothing happens. No error message, nothing. Also, when I try to play songs on my com

  • Help with moving hard drives

    Hi all, I'm having an issue. My iTunes library is spread across 2 external hard drives, because it's too large to fit on one. Today, after OS X hard crashed, one of the disks is reporting that Disk Utility is 'unable to repair' the disk and that I sh

  • One of my contacts is reduced to a single blue line

    I have one contact, and only one, that appears in my message list as a single blue line, where all of the others are properly displayed with the name of the contact. Does anyone have any ideas as to how I can get that one contact to display properly.

  • Command-Tab macro not functional!

    After I upgraded to 10.4.7, the Command-Tab macro is no longer functional, I need to know what is going on. I thought that maybe since I've upgraded to Tiger, I've had to use Tiger Cache Cleaner to clean the system caches in order to make the upgrade