Ti refine the question. Here is a simple custom Table cell renderer that
sets background of a particulr row to a particular color:
// ---------------------------------------
class ColoredTableCellRenderer
extends DefaultTableCellRenderer
{
public Component getTableCellRendererComponent
(JTable table, Object value, boolean selected, boolean focused, int
row, int column)
{
setEnabled(table == null || table.isEnabled()); // see question
above
if ((row % 5) == 0)
setBackground(Color.green);
else
setBackground(null);
super.getTableCellRendererComponent(table, value, selected, focused,
row, column);
return this;
}
}
How can I specify this row # at run time? I.e., color any row I need with a
particular color.
Many thanks.
-----Original Message-----
From: Reinstein, Lenny
Sent: Wednesday, November 28, 2001 10:06 AM
To: [EMAIL PROTECTED]
Subject: JTable: setting row background color.
What is the easiest way to set the row color at run time in JTable? I would
like to implement something like setRowColor(int rowNumber)?
I know I can implement a new Table renderer where the object may have that
information. The issue is that I already have a table implemented that work
with the array of Strings, and I don't want to change this.
Thanks in advance.
-Lenny, New York.
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing