Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to disable a certain treenode in a jtree

 
Tal Tal
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 1535
 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fogot. Change the code of MyRenderer class to restrict selection of disabled node.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic