Title: Message
To set row index 4 to have a background colour of red, override the default renderer:

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);
 
    if (row == 4)
    {
        c.setBackground (Color.red);
    }
 
    return c;
}

----- Original Message -----
From: Bhangale, Bhushan
To: '[EMAIL PROTECTED]'
Sent: Friday, August 30, 2002 1:38 PM
Subject: RE: JTable row renderer


That I also know that I have to do for row. I want to know how??

-----Original Message-----
From: Krishnakumar CS [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 8:35 AM
To: 'Bhangale, Bhushan'; '[EMAIL PROTECTED]'
Subject: RE: JTable row renderer


Fine, but there is no row renderer. So you have to do it for all the cells in the row
-----Original Message-----
From: Bhangale, Bhushan [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 5:42 PM
To: '[EMAIL PROTECTED]'
Subject: RE: JTable row renderer


I did that but its a cell renderer not a row renderer. I want a full row to get colored depending upon a column value.
-----Original Message-----
From: Vikram Kumar [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 11:00 PM
To: Bhangale, Bhushan
Cc: '[EMAIL PROTECTED]'
Subject: Re: JTable row renderer


Hi!
 You will have to override the TableCellRenderer for that and set the background.. Have you tried  doing that ???

vikram

Bhangale, Bhushan wrote:

Hi All,

I want to color a row based on time. I have four columns in a row in which one column is storing time. I want to highlight the whole row say till 1 minute. When I get a data from my application I store it in TableModel with the time column holding the value of time when the record arrived. Now till that time to say 1 minute the row should be highlighted.

Please help, it is urgent.

Thanks & Regards
Bhushan Bhangale
Sr. Software Engineer
Fusion Infotech India Private Ltd.
Ph. no. - 1-212-641-6932 (O)




"The information in this e-mail, and any attachment therein, is
confidential and for use by the addressee only. If you are not the
intended recipient, please return the e-mail to the sender and delete
it from your computer. Although The Bank of New York attempts to
sweep e-mail and attachments for viruses, it does not guarantee that
either are virus-free and accepts no liability for any damage sustained
as a result of viruses."






"The information in this e-mail, and any attachment therein, is
confidential and for use by the addressee only. If you are not the
intended recipient, please return the e-mail to the sender and delete
it from your computer. Although The Bank of New York attempts to
sweep e-mail and attachments for viruses, it does not guarantee that
either are virus-free and accepts no liability for any damage sustained
as a result of viruses."





"The information in this e-mail, and any attachment therein, is
confidential and for use by the addressee only. If you are not the
intended recipient, please return the e-mail to the sender and delete
it from your computer. Although The Bank of New York attempts to
sweep e-mail and attachments for viruses, it does not guarantee that
either are virus-free and accepts no liability for any damage sustained
as a result of viruses."

Reply via email to