Skip to main content

Setting editor/renderer for JTreeTable

1 reply [Last post]
jonathansimon
Offline
Joined: 2003-06-07

I'm trying to switch my old JTreeTable code out for the new JDNC stuff. Im having trouble setting a new editor/renderer for the tree.

Basically, I dont want the tree to look like a file explorerer -- I actually want it to look more like the demo for the JDNC XML stuff. (speaking of which, I dug through the src and didnt immediately see that code either).

Any tips?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rameshgupta
Offline
Joined: 2004-06-04

> I'm trying to switch my old JTreeTable code out for
> the new JDNC stuff. Im having trouble setting a new
> editor/renderer for the tree.

Do you have a custom tree cell renderer and editor with specialized needs? If so, we'd like to know.

The new treetable design treats the tree strictly as an implementation detail and does not leak a reference to that through the public api. This is to ensure that the internal state of the tree stays in sync with the state of the treetable.

All of the work necessary to set up the renderer and editor for the hierarchical column is done internally by JTreeTable. Please see JTreeTable.setTreeTableModel for details on how this is done. The idea is that users should not have to deal with these.

>
> Basically, I dont want the tree to look like a file
> explorerer -- I actually want it to look more like
> the demo for the JDNC XML stuff. (speaking of which,
> I dug through the src and didnt immediately see that
> code either).
>
> Any tips?

JTreeTable has dedicated methods for these. Please see setOpenIcon, setClosedIcon, setLeafIcon, setExpandedIcon, and setCollapsedIcon.

Hope this helps.

Ramesh