aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to disable a certain treenode in a jtree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to disable a certain treenode in a jtree" Watch "How to disable a certain treenode in a jtree" New topic
Author

How to disable a certain treenode in a jtree

Tal Tal
Ranch Hand

Joined: Dec 10, 2003
Posts: 40
hi
how can i disable only a certain treenode in a jtree?
i know that if i use setEnabled(false) on a jtree it would disable
the entire tree, but there's no such method to invoke on a treenode
Tal Tal
Ranch Hand

Joined: Dec 10, 2003
Posts: 40
can anyone help me with this? , it is really important
i want to make some of the nodes in a jtree as disabled and another part to set as enabled
how can i do that?
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Preventing the Expansion or Collapse of a Node in a JTree Component
Serghei Jelauc
Ranch Hand

Joined: Jul 24, 2002
Posts: 128
Hi.
I am not sure if it is the good solution, but at list it works.
Here the code:




and code for JFrame


Hope it will help.

If you have found better solution please post it.
[ December 01, 2004: Message edited by: Serghei Jelauc ]

SCJP 1.4 <br />SCBCD 1.3<br />SCWCD 1.4
Serghei Jelauc
Ranch Hand

Joined: Jul 24, 2002
Posts: 128
I fogot. Change the code of MyRenderer class to restrict selection of disabled node.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to disable a certain treenode in a jtree