This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTree and JEditorPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree and JEditorPane" Watch "JTree and JEditorPane" New topic

JTree and JEditorPane

Deyna Cegielski
Ranch Hand

Joined: Nov 24, 2004
Posts: 60
ive been implementing a help system that uses a splitpane with a jtree in the left side (which allows the user to navigate to diferent help sections) and a jeditorpane in the right side (which will display the information).

ive setup to jtree with no problems and added the treeselectioneventlistener to listen and respond to changes in selection, but ive become a little unstuck as to how i am going to translate a selection, into loadin the appropriate document into the jeditorpane.

any ideas?

been working on this most of the afternoon there may be an easier way to do this but i have been trying to get the index of the selected node, its parent(if it has one) and its grandparent(if it has one) and so forth...



so if the user selects node 2 in root 2 i want to be able to get the index path to the node, i.e 0,2,1 (have my own plans of what i want to do with this path). getting he correct path is proving to be tricky.

any help would be appreciated

[ April 20, 2006: Message edited by: Deyna Cegielski ]
[ April 20, 2006: Message edited by: Deyna Cegielski ]
Consider Paul's rocket mass heater.
subject: JTree and JEditorPane
Similar Threads
GridBagLayout - anchoring
JTree - explicitly select a node
dates in sql to dates in java
XML to DOM to JTree
sorting node position in JTree