aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTree - explicitly select a node Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree - explicitly select a node" Watch "JTree - explicitly select a node" New topic
Author

JTree - explicitly select a node

Deyna Cegielski
Ranch Hand

Joined: Nov 24, 2004
Posts: 60
my help interface consists of a split pane with a jtree on the left and a jeditorpane on the right.

clicking on a node in the tree heirarchy loads the relevant page into the editorpane

ive added a toolbar that lets you move back and forward through your visited page history (similar to ie). the problem is the last node selected before you start using the back and forward buttons remains selected throughout.

is there a method that explicitly highlights a particular node item, so when a user clicks back, the node that is highlighted becomes deselected and the node whos page has just loaded becomes highlighted.

thanks
[ April 21, 2006: Message edited by: Deyna Cegielski ]
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
In the JTree api there are a number of methods that will change the selection state, egs, setSelectedRow, removeSelectionRow, setSelectionPath, cancelSelection.
Deyna Cegielski
Ranch Hand

Joined: Nov 24, 2004
Posts: 60
thanks i must have missed those, pinpointing the method your after cna be quite tricky at times
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JTree - explicitly select a node