Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jtree related problem  RSS feed

 
Anand Loni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using JTree and I want to make particular node of the tree invisible. How can I do this ?
I am using DefaultMutableTreeNode as nodes of the tree.

Thanx in Advance
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DefaultMutableTreeNode is not a Component so you cannot make it visible or invisible. Nor can you disable it. All you can do is use a renderer so that it draws the Node in a different manner depending on some attribute that you associate with the Node
Hope that it helps
 
Ben Zung
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I have been truely thinking you can do whatever you want using Java.
Nobuo Tamemasa wrote some neat stuff to disable/enable a tree node a while back but still worth referencing.
http://www.codeguru.com/java/articles/313.shtml

Good luck.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!