"Frank D. Greco" schrieb:
>
> My original post:
> >>I need to set the row color for my subclass of JTable.
> >>All the example code that I've discovered show how to
> >>change the color of a *column*.
>
> At 06:14 AM 5/10/2002 -0700, Roger Talkov wrote:
> >You need to have your own TableCellRenderer and have it set the colors,
> >using the tables default renderer won't work.
>
> I got that impression from reading a couple of Swing books
> and a couple of online articles, but got any sample code?
>
> So if I need to *dynamically* change color of a row (e.g., I just
> got an incoming JMS msg and I need to change the color of the 5th
> row to red), I have to put this intelligence into the renderer?
> In other pseudo-code words:
>
> On incoming JMS msg
> if a row needs to be red
> statusObj.colorChangeRequest(true)
> statusObj.setRowColor(row-num, some-color)
>
>
> MyOwnCellRenderer
> If color change required
> Look at statusObj for info
> set color of that row
>
> Does this sound reasonable? This stuff is just not documented
> too well imho.
>
More or less that's correct - the less part is that a renderer never is
concerned with change, it only is concerned about current state at the
time of rendering. So it simply always asks the statusObj for the
apropriate rowColor. Or better: it asks the statusObj about its status -
may be two- or multistate - and then decides about color itself (or asks
someone who might know - f.i. the UIManager). Same holds if you decide
to implement the coloring in the table.getCellRenderer(row, col).
Greetings
Jeanette
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing