That should be a cell renderer issue ...
Srikanth - 19 Jan 2006 09:48 GMT
No that node shouldn't be rendered at all..
> How can i hide and show some nodes in the tree based on some criteria?
> Right now i done it this way(given below). But its not working...
[quoted text clipped - 7 lines]
> nodes
> c) getChild() gives that node.
That's going in the right direction. What one typically does is to
implement a wrapper model. It wraps the original model, provides the
same API (TreeModel), but does some filtering on the original model data
before passing it through.
In your case such a wrapper model would take your isVisible() flag in
the tree nodes into account when responding to getChild...() method
invocations. Very similar to what you did in your subclassed model
implementation.
There is some example for a JList or JTable in Sun's GUI tutorial to
sort list data before it is displayed. The structure is the same for a
Tree Model.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/