Board index » jbuilder » Re: JdbTable rowColors

Re: JdbTable rowColors


2006-01-27 01:56:33 AM
jbuilder3
< XXXX@XXXXX.COM >wrote:
Quote
Did anyone tried to paint jdbTable rows with two diffirent background
colors.
In a way that every second row is in diffirent color(for example first row
is white, second is blue, third is white fourth is blue and so on...). I
did some work with ColumPaintListener and painted just columns.
That was based on certain Column value(numeric).
So where to look for row painting, and I would like to keep other default
JdbTable stuff intact...Thanx in advance...bye...
A search of Google yields the following:
groups.google.ca/group/borland.public.jbuilder.dbswing/browse_thread/thread/16ec9a94938e4b5/7071bd6cd2ad664d
AKA
tinyurl.com/9oou4
--
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:Re: JdbTable rowColors

Hi.
Did anyone tried to paint jdbTable rows with two diffirent background
colors.
In a way that every second row is in diffirent color(for example first row
is white, second is blue, third is white fourth is blue and so on...). I did
some work with ColumPaintListener and painted just columns.
That was based on certain Column value(numeric).
So where to look for row painting, and I would like to keep other default
JdbTable stuff intact...Thanx in advance...bye...
 

Re:Re: JdbTable rowColors

Hi,...hmmm..In post Kevin said that I need column paint listener for every
column. That is potentially a lot of listeners in some cases.
Well I did it with extending JdbTable, and overriding prepareRenderer method
like this:
"import com.borland.dbswing.JdbTable;
import javax.swing.table.TableCellRenderer;
import java.awt.Component;
import java.awt.Color;
public class MyJdbtable extends JdbTable {
public MyJdbtable() {
super();
}
public Component prepareRenderer(TableCellRenderer renderer,
int rowIndex, int vColIndex)
{
Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
if (rowIndex % 2 == 0 ) {
c.setBackground(Color.orange);
} else {
c.setBackground(getBackground());
}
return c;
}
}"
Can't I register just one column paint listener on "important" column, and
repaint whole row for things that need to be repainted...
Right now I know how to repaint paintSite with ColumnPaintListener, and that
is just one cell...any more ideas, ...thatnx in advance....bye...
"Kevin Dean [TeamB]" < XXXX@XXXXX.COM >je napisao u poruci
interesnoj grupi:xn0ehoyutdr0fn001-kdean@www.teamb.com...
Quote
< XXXX@XXXXX.COM >wrote:

>Did anyone tried to paint jdbTable rows with two diffirent background
>colors.
>In a way that every second row is in diffirent color(for example first row
>is white, second is blue, third is white fourth is blue and so on...). I
>did some work with ColumPaintListener and painted just columns.
>That was based on certain Column value(numeric).
>So where to look for row painting, and I would like to keep other default
>JdbTable stuff intact...Thanx in advance...bye...

A search of Google yields the following:

groups.google.ca/group/borland.public.jbuilder.dbswing/browse_thread/thread/16ec9a94938e4b5/7071bd6cd2ad664d

AKA

tinyurl.com/9oou4

--
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:Re: JdbTable rowColors

Forget what i said in last post,
I did it as You suggested, it's working, although it needs more work to be
done right. I must say this is very useful for avoiding cellrenderers.
When combined with code from my previous post, it doesn't work, i see only
stripes, columnPaint is gone...
Thanx for help. If someone had similar situation and solved it, please post
some advice, I have a lot of other work, ...time is short....
Bye..