expanding a Jtree...



I am trying to expand a Jtree to the newly added node... however I
can't seem to make it happen.

I've tried a number of things which I listed below, all of these were
tried seperately and together, however the Jtree still does not expand
:(

I also tried to use invalidate and repaint and validate to refresh the
screen, nothing seems to happen...

this is what I have tried so far...

this.fireTreeExpanded(new TreePath(mtnNode.getPath()));

this.expandPath(new TreePath(parentNode.getPath()));

this.scrollPathToVisible(new TreePath(mtnNode.getPath()));

any ideas?

.



Relevant Pages

  • Re: JTree and Empty Nodes
    ... > The JTree displays the + sign on al nodes that is known to have children ... > get rid of the + sign on empty nodes if you force the JTree to expand ... > register a TreeExpansionListener on the JTree that calls this method ...
    (comp.lang.java.gui)
  • Re: JTree and Empty Nodes
    ... > leaf but it isnt a children). ... get rid of the + sign on empty nodes if you force the JTree to expand them. ... register a TreeExpansionListener on the JTree that calls this method ...
    (comp.lang.java.gui)
  • Expanding certain path to certain node in a JTree
    ... My program involves adding a node to another node in a JTree. ... then when the operation has been done, expand the tree to this node. ... I've tried everything from these forums etc - i think im having ...
    (comp.lang.java.programmer)
  • How to enumerate a JTree
    ... I want to do the following with a JTree ... - enumerate each node ... - if not expanded, then expand the node. ... Prev by Date: ...
    (comp.lang.java.programmer)
  • Re: automatic refreshing of JTree not working
    ... I'm having a hell of a time trying to get a JTree to automatically refresh to show that a node has been moved from one parent node to another. ... I tried the reloadmethod of the tree model and of course when I do that the entire tree collapses and that isn't what I want method useful). ... And *that* issue is due to how JNDI sends search requests to a server. ... I thought if I go back to simplifying my code to make the JTree update itself then I wouldn't even have to go back to my data source, at least for refreshing the node that had one of its children removed. ...
    (comp.lang.java.gui)