Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2006

Tip: Looking for answers? Try searching our database.

how to fire JTree child node event

Thread view: 
William Z. - 26 Dec 2006 21:25 GMT
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 - 27 Dec 2006 03:58 GMT
> 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.
Ingo Buescher - 30 Dec 2006 11:17 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.