Jtree: how to hide portions of a given text defaulttutabletreenode?

Say that my JTree consists of the following nodes.

new DefaultMutableTreeNode("DisplayThisTextOnly {donotdisplaystringsinhere}");

how can i hide text between and turning {} from display using TreeCellRenderer?

when i select this node i want to get the whole row again.

"DisplayThisTextOnly {donotdisplaystringsinhere}"

Basically my goal is to be able to extract additional data from a given node tree without the need setObject()

0
source share
1 answer

Create your own renderer and cross out the text that you do not want to see. In the Swing tutorial on How to Use Trees, there is an example of a renderer to get you started.

+2
source

All Articles