* Creates a TableCellRenderer to color a particualr column with particular data.
*/
class ColoredTableCellRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent (JTable table, Object value, boolean selected, boolean focused, int row, int column) {
String strValue = value.toString();
setBackground(Color.red);
}
else if (strValue.equalsIgnoreCase("ERROR")) {
setBackground(Color.magenta);
}
else if (strValue.equalsIgnoreCase("WARN")) {
setBackground(Color.yellow);
}
else if (strValue.equalsIgnoreCase("INFO")) {
setBackground(Color.green);
}
else {
setBackground(null);
}
}
}
}
From: Dave Wathen [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 1:24 AM
To: Bhangale, Bhushan; [EMAIL PROTECTED]
Subject: RE: JTable row renderer
Dave Wathen
Canzonet Limited
Phone: +44 (0)20 8660
5171
Mobile: +44 (0)7968 167934
Fax: +44 (0)870 051 7664
http://www.canzonet.com
mailto:[EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Bhangale, Bhushan
Sent: 29 August 2002 21:29
To: '[EMAIL PROTECTED]'
Subject: JTable row rendererHi 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."
