JTree: How to remove rootHandles from all nodes in SOME trees in an application

Hi
I need to remove rootHandles from some trees in the application.
So, I can't set a general UIDefault or something like that to affect all trees.
showRootHandles(false) only operates on the root node as far as I can see.
Thanks
richard_fairallAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
Hmmm, try setting the expanded and collapsed icons to blank icons.
0
 
objectsCommented:
The UI properties should only apply to any trees created *after* you change the property.
0
 
richard_fairallAuthor Commented:
Thanks for the replies (the one for connecting lines as well).
The connecting lines job works fine, using UIManager.put("Tree.paintLines", Boolean.FALSE);
However, I can't get rid of rootHandles on all nodes using UIManager.put("Tree.showsRootHandles", Boolean.FALSE);

Is this the correct default string? and Where on earth (Switzerland at the moment) do I find definitions of
the strings for the default UI stuff?
By the way, it's beer'oclock.
Thanks.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
objectsCommented:
What L&F are you using?
0
 
richard_fairallAuthor Commented:
Several look and feels,
Windows, EclipseL&F,  Metal, most are Jidesoft things.
Perhaps I have to set the UIDefault for showsRootHandles before
creating a node?
0
 
objectsCommented:
I would have thought the follwoing would work:

 tree.setShowsRootHandles(false);

Let me check and get back to you.

0
 
objectsCommented:
try setting UImanager properties "Tree.expandedIcon" and "Tree.collapsedIcon" to null.
0
 
richard_fairallAuthor Commented:
Tried  the following:

      UIManager.put("Tree.expandedIcon", null);
      UIManager.put("Tree.collapsedIcon", null);

No change, little  boxed + or  -  icon still there.


0
 
objectsCommented:
What L&F did u test it on?
0
 
richard_fairallAuthor Commented:
I have tried 6 different LAFs: Windows, eclipse metal, xerto (all from JideSoft inc)
They all still show the doobries.
Code is:
    UIManager.put("Tree.paintLines", Boolean.FALSE);
    UIManager.put("Tree.showsRootHandles", Boolean.FALSE);
    UIManager.put("Tree.expandedIcon", null);
    UIManager.put("Tree.collapsedIcon", null);

and:
    tree.putClientProperty("JTree.lineStyle", "None");
    renderer.putClientProperty("JTree.lineStyle", "None");

    tree.setShowsRootHandles(false);
    tree.setRootVisible(false);

The lines dont show.

0
 
richard_fairallAuthor Commented:
OmiGawd
I forgot this trick! Works fine.

How to I find out about these resources like  "Tree.expandedIcon" ?

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.