Skip to main content

JXTable and LAF provided alternate row color - revisited

4 replies [Last post]
kleopatra
Offline
Joined: 2003-06-11

Hi folks,

we have been struggling with the problem on and off - me always retreated into: that's not the SwingX way of life, pointing fingers to others to adjust. Recently, I got an idea (actually implemented in a closed-source project) which would allow to have the best of both: make CellContext responsible to return the alternate color if available.

That's a slight drift from Highlighter-only-for-visuals dogma - on the other hand: laf-provided colors _could_ be regarded as defaults to be supplied by the context.

Comments, please?

CU
Jeanette

Note: this would not work for Nimbus - which has major problems with transparency - because SwingX explicitly removes the uiproperty in tableAddon.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kleopatra
Offline
Joined: 2003-06-11

committed as revision #3783 (nobody shouted quickly enough )

TableCellContext will return the alternateRowColor as default if
- the option is globally enabled with a for Boolean.TRUE for uiproperty TableCellContext.HANDLE_ALTERNATE_ROW_BACKGROUND
- the UImanager has a alternateRowColor
- the row index is odd

RendererVisualCheck has a test method to play with. Eager for feedback (beware: will close the issue as fixed even without )

CU
Jeanette

kschaefe
Offline
Joined: 2006-06-08

Seems like a reasonable way of respecting the colors supplied by a L&F.

Karl

tbee
Offline
Joined: 2003-07-23

I have not dived into SwingX deep enough to comment on the suggestion. What I do know is that I disabled all highlighter stuff on JXTable (and had to implement it myself) because it was conflicting with my cell renderers and LaFs. We had a prior discussion about this.

kleopatra
Offline
Joined: 2003-06-11

Tom,

we had more than one prior discussion if I remember correctly Your problems most probably will not be fixed by this change - it's only about respecting alternateRowColor, nothing else. The mis-behaviour of core DefaultTableCellRenderer and LAF provided renderers which extend that class is uneffected.

CU
Jeanette