 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Zvonko Guest
|
Posted: Tue Aug 29, 2006 8:13 am Post subject: JdbTable select column |
|
|
Hi!
Could someone be so kind and explain (perhaps on example) how to achieve
that when a user click column header on jdbTable, I paint that column
background yellow and select it. And when user clicks another column the
same thing should happen, and deselect the first column and paint deselected
columns background in white and selected yellow.
Thanks
Zvonko |
|
| Back to top |
|
 |
Kevin Dean [TeamB] Guest
|
Posted: Wed Aug 30, 2006 3:12 am Post subject: Re: JdbTable select column |
|
|
Zvonko wrote:
| Quote: | Could someone be so kind and explain (perhaps on example) how to achieve
that when a user click column header on jdbTable, I paint that column
background yellow and select it. And when user clicks another column the
same thing should happen, and deselect the first column and paint
deselected columns background in white and selected yellow.
|
I'm not sure if there's a listener for clicking on a column header, but
you can customize the painting using a ColumnPaintListener. Here's code
for one I use that colours a row yellow based on the content of the row:
private ColumnPaintListener columnPaintListener = new ColumnPaintAdapter() {
public void painting(DataSet dataSet, Column column, int row, Variant value, CustomPaintSite paintSite) {
if (paintSite instanceof TableFastStringRenderer) {
Variant allocated = new Variant();
dataSet.getDisplayVariant(allocatedColumnOrdinal, row, allocated);
paintSite.setBackground(allocated.getAsBoolean() ? Color.WHITE : Color.YELLOW);
}
}
};
....
allocatedColumnOrdinal = eventsDataSet.getColumn("allocated").getOrdinal();
try {
for (int index = 0; index < eventsDataSet.getColumnCount(); index++) {
eventsDataSet.getColumn(index).addColumnPaintListener(columnPaintListener);
}
}
catch (TooManyListenersException ex) {
// Ignore exception.
}
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|