tree icon is getting displayed even if there are no childrens
Is there any other way by which the tree icon can be made to display
without the usage ofsetAllowsChildren() method ofjavax.swing.tree.DefaultMutableTreeNode., bcos if i set
setAllowsChildren(true) for a particular node then the tree icon appears, irrespective of it having any children.
How do i perform necessary validation so that the icon is set only if the particular node has children?
Thanks in advance
[464 byte] By [
jaaya] at [2007-10-2 16:55:54]

You could write your own TreeCellRenderer to show empty nodes that
are capable of having children. Sun's Tutorial has an example here:
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
(in the section "Customizing a Tree's Display").
You should note that typical usage (for example in file system viewers)
is for things that could have children (folders/directories) to be
drawn the same way whether or not they do, in fact, have children. But
you are free to change this convention, of course.
If you have difficulty implementing this the Swing forum would be the
best place to post your code.