Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Empty JTree in jre1.3.X  RSS feed

 
Petr Blahos
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

What is the best way to create an empty JTree in jre1.3.X?
In 1.4 I could do it by I can supply null to JTree constructor
or DefaultTreeModel constructor but in 1.3 it throws an
IllegalArgumentException.

Currently I do:
new DefaultTreeModel(new DefaultMutableTreeNode("--"));
tree.setRootVisible(false);

which works fine, but then when I have the content I have
to call setRootVisible(true), and when the content is gone,
I have to setRootVisible(false) again.

Is there any better way how to do it?

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