Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to set Background on cell of jdbTable

0 views
Skip to first unread message

Christian Brändle

unread,
Jul 9, 2000, 3:00:00 AM7/9/00
to
I tried the column.setBackground but this only changes the color of a
cell if it is selected. How can I customize the color of a cell?

Thanks,
Chris


Tad Frysinger

unread,
Jul 18, 2000, 3:00:00 AM7/18/00
to
In article <3968A6CB...@active.ch>, cbr...@active.ch says...
Use a column paint listener:

column1.addColumnPaintListener(
new com.borland.dx.dataset.ColumnPaintAdapter()
{
public void painting(DataSet dataSet,
Column column,
int row,
Variant value,
CustomPaintSite paintSite)
{
column1_painting(dataSet, column, row, value, paintSite);
}
});


void column1_painting(DataSet dataSet,
Column column,
int row,
Variant value,
CustomPaintSite paintSite)
{
// paint odd values red, even values green
if ((value.getShort() & 0x1) == 1)
{
paintSite.setBackground(Color.red);
}
else
{
paintSite.setBackground(Color.green);
}
}


Tad Frysinger(TeamB)

0 new messages