Board index » jbuilder » how to add color to column in a JDBTABLE

how to add color to column in a JDBTABLE


2005-07-12 02:04:55 AM
jbuilder18
I have a table with the following columns.
I want to add grey color for column date and value1 and leave the rest of
the columns alone.
sample output:
date value1 value2 value3
7/02/2005 100 200 300 ..
Thanks,
Tom
 
 

Re:how to add color to column in a JDBTABLE

tom wrote:
Quote
I have a table with the following columns.

I want to add grey color for column date and value1 and leave the
rest of the columns alone.
myDataSet.getColumn("my_column_name").addColumnPaintListener(new
ColumnPaintAdapter() {
public void painting(DataSet dataSet, Column column, int row, Variant
value, CustomPaintSite paintSite) {
if (paintSite instanceof TableFastStringRenderer) {
paintSite.setBackground(Color.YELLOW);
}
}
}
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
info.borland.com/newsgroups/guide.html
 

Re:how to add color to column in a JDBTABLE

Thanks very much for your help Kvein.
Tom
"Kevin Dean [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
tom wrote:

>I have a table with the following columns.
>
>I want to add grey color for column date and value1 and leave the
>rest of the columns alone.

myDataSet.getColumn("my_column_name").addColumnPaintListener(new
ColumnPaintAdapter() {
public void painting(DataSet dataSet, Column column, int row, Variant
value, CustomPaintSite paintSite) {
if (paintSite instanceof TableFastStringRenderer) {
paintSite.setBackground(Color.YELLOW);
}
}
}

--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
www.datadevelopment.com/

NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
www.datadevelopment.com/papers/index.html

Please see Borland's newsgroup guidelines at
info.borland.com/newsgroups/guide.html
 

{smallsort}

Re:how to add color to column in a JDBTABLE

Hi Kevin,
I have three radio button ,and I want one of the columns to be painted when
user is clicked on the one of the radio buttons that corresponding to that
column.
when user select column1, it is painted yellow.
when user select column2 , it is painted yellow, column1 reset to white
background.
when user select column3 , it is painted yellow, column1 and column 2 are
reset to white background.
Is there a way to dynamically add or remove color from a column? I can not
remove the color once it was painted when I'm using the following code.
value1,value2, value3 is the database column name.
code:
...
//add color to column when user click on this radio button.
public void jUpdate_SQL_actionPerformed(ActionEvent e) {
queryDataSet_View.getColumn("value2").addColumnPaintListener( new
ColumnPaintAdapter() {
public void painting(DataSet dataSet, Column column, int row, Variant
value, CustomPaintSite paintSite) {
paintSite.setBackground(Color.yellow);
}
}
);
}
//remove color from column when user click on the next column.
public void jUpdate_SQL_focusLost(FocusEvent e) {
queryDataSet_View.getColumn("value2").addColumnPaintListener( new
ColumnPaintAdapter() {
public void painting(DataSet dataSet, Column column, int row, Variant
value, CustomPaintSite paintSite) {
paintSite.setBackground(Color.white);
}
}
);
}
Thanks,
Tom
"tom" < XXXX@XXXXX.COM >wrote in message
Quote
Thanks very much for your help Kvein.

Tom

"Kevin Dean [TeamB]" < XXXX@XXXXX.COM >wrote in message
news:xn0e4nob517jw8001-kdean@www.teamb.com...
>tom wrote:
>
>>I have a table with the following columns.
>>
>>I want to add grey color for column date and value1 and leave the
>>rest of the columns alone.
>
>myDataSet.getColumn("my_column_name").addColumnPaintListener(new
>ColumnPaintAdapter() {
>public void painting(DataSet dataSet, Column column, int row, Variant
>value, CustomPaintSite paintSite) {
>if (paintSite instanceof TableFastStringRenderer) {
>paintSite.setBackground(Color.YELLOW);
>}
>}
>}
>
>--
>Kevin Dean [TeamB]
>Dolphin Data Development Ltd.
>www.datadevelopment.com/
>
>NEW WHITEPAPERS
>Team Development with JBuilder and Borland Enterprise Server
>Securing Borland Enterprise Server
>www.datadevelopment.com/papers/index.html
>
>Please see Borland's newsgroup guidelines at
>info.borland.com/newsgroups/guide.html