how to fire JTree child node event  
Author Message
William Z.





PostPosted: 2006-12-27 5:25:00 Top

java-programmer, how to fire JTree child node event 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?

 
Brandon McCombs





PostPosted: 2006-12-27 11:58:00 Top

java-programmer >> how to fire JTree child node event William Z. wrote:
> 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.





PostPosted: 2006-12-27 16:02:00 Top

java-programmer >> how to fire JTree child node event >
> 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.

 
 
Ingo Buescher





PostPosted: 2006-12-30 19:17:00 Top

java-programmer >> how to fire JTree child node event William Z. wrote:
> 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