Skip to main content

Little bit confused ( still Renderer problem )

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2011-03-29


Since a few hours I try to figure out how the best ( easiest ) way is to provide an own Renderer for a JXTree with the following constraints :

- set the preferredSize of the node
- set an icon( in different sizes maybe )
- set a Painter<?> ( I want to use an ImagePainter for difficult renderings )
- set selected/focus/... state even if I use a ImagePainter, that fills the complete Area of the nodes JXLabel

What I understand till now is the concecpt of the StringValue ... this is easy to use - nice

What I not complete understand is what kind of class I should implement

There are the following classes I visit and tryed to understand their interactions...

- CellContext
- DefaultVisuals
- ComponentProvider
- and all its Subclasses for JXTree

This is - for me - a very complex framework.
I don't want to create an own CellContext StringValue( this is ok ) and ComponentProvider for a "simple" JXTree I want to customize.
The approach to create only one class which implements TreeCellRenderer and extends a UI-Class like JXLabel is much easier for
me to write. Moreover I got only one new class, not three or two.

Don't misunderstand me. I like SwingX very much from the beginning till now and I use it in every GUI-tool I write.
This is only a little hint ...