aspose file tools*
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree and JEditorPane" Watch "JTree and JEditorPane" New topic
Author

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...

e.g.

-root1
--node1
--node2
--root2
----node1
----node2

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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree and JEditorPane