Link to home
Start Free TrialLog in
Avatar of richard_fairall
richard_fairall

asked on

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
Avatar of Mick Barry
Mick Barry
Flag of Australia image

The UI properties should only apply to any trees created *after* you change the property.
Avatar of richard_fairall
richard_fairall

ASKER

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.
What L&F are you using?
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?
I would have thought the follwoing would work:

 tree.setShowsRootHandles(false);

Let me check and get back to you.

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

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

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


What L&F did u test it on?
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.

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OmiGawd
I forgot this trick! Works fine.

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