I have a JTree where each node displays a specific view when selected.
I'd like to somehow fire an event to default the app which view to
display when opened.
How do I fire an event for a JTree as if the user clicked on a specific
child node?
> I have a JTree where each node displays a specific view when selected.
> I'd like to somehow fire an event to default the app which view to
> display when opened.
>
> How do I fire an event for a JTree as if the user clicked on a specific
> child node?
You don't have to fire an event because the JTree will do that for you.
All you have to do is setup a TreeExpansionListener and
TreeSelectionListener.
William Z. - 27 Dec 2006 08:02 GMT
> You don't have to fire an event because the JTree will do that for you.
> All you have to do is setup a TreeExpansionListener and
> TreeSelectionListener.
How so? You mean if I select a node by clicking on it w/ the mouse? I
don't want to have to select a node with the mouse. As soon as my app
initializes, I wan't to programmatically fire an event to do this
automatically.
> I have a JTree where each node displays a specific view when selected.
> I'd like to somehow fire an event to default the app which view to
> display when opened.
>
> How do I fire an event for a JTree as if the user clicked on a specific
> child node?
If I understand you correctly the following methods in JTree might help:
void setSelectionPath(TreePath path)
void setSelectionRow(int row)
IB