 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Thu Jan 26, 2006 11:46 pm Post subject: 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... |
|
| Back to top |
|
 |
Kevin Dean [TeamB] Guest
|
|
| Back to top |
|
 |
Guest
|
Posted: Fri Jan 27, 2006 1:59 pm Post subject: 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]" <NkOdSePaAnM (AT) datadevelopment (DOT) com> je napisao u poruci
interesnoj grupi:xn0ehoyutdr0fn001-kdean (AT) www (DOT) teamb.com...
|
|
| Back to top |
|
 |
Guest
|
Posted: Fri Jan 27, 2006 4:55 pm Post subject: 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.. |
|
| 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
|
|