Anybody got an idea??
How are you setting up the TreePath?
Christian
treeModel.nodeStructureChanged(node);
or:
treeModel.nodeChanged(node);
In article <8l6k0g$t03$1...@trinity.hannover.sgh-net.de>,
"Marco Stoll" <m.s...@w3design.de> wrote:
> I'm using a JTree and trying to programmly expand to a specific Node.
I'm
> using the JTree.expandPath(TreePath) Method to invoke this action, but
> nothing happens.
>
> Anybody got an idea??
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Try scrollPathToVisible(TreePath) instead and optionally
setSelectionPath(TreePath).
--
OODGR
To the OP: Does this mean that the node should become "viewable", but
may possibly be a leaf? Then use makeVisible(). expandPath() silently
(argh!) ignores requests to make leafs viewable.
See the JTree javadoc for the definition of "viewable" and "expanded"
and for that horrible (non-)specification of the behaviour of expand-
Path().
> I'm
>> using the JTree.expandPath(TreePath) Method to invoke this action, but
>> nothing happens.
> Ye, you need to refresh the expanded node:
>
> treeModel.nodeStructureChanged(node);
> or:
> treeModel.nodeChanged(node);
This is relevant to the problem exactly because of?
There are no methods nodeStructureChanged or nodeChanged in TreeModel,
only in DefaultTreeModel. And it is not a requirement to use Default-
TreeModel. So that cannot possibly be any solution, even without know-
ing what these methods might do.
Christian
>I'm using a JTree and trying to programmly expand to a specific Node. I'm
>using the JTree.expandPath(TreePath) Method to invoke this action, but
>nothing happens.
>Anybody got an idea??
This is but a guess, but you could try calling
fireTreeExpanded() or something such as well.
--
Timo.Ra...@helsinki.fi
Help keep Usenet clean: <URL: http://www.hut.fi/u/jkorpela/usenet/dont.html >