JTree : Showing the selected node as the first node in the scroll pane
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, May 24, 2002 08:15 AM

I have a large JTree to be displayed. THe Jtree is added to a JScrollPane and then I use the following to make the current node visible.

scrollPathToVisible(treePath)

This does bring the selected node in the view area. But I want to make this the first node in the view area. Please help.

Re: JTree : Showing the selected node as the first node in the scroll pane

Posted By:   Samir_Randive  
Posted On:   Friday, May 24, 2002 09:15 PM

You can try this.

Rectangle rect = tree.getPathBounds(treePath);
JViewport view = scrollPane.getViewport();
view.setViewPosition(rect.getLocation());

Let me know if this works.




cheers...


Samir
About | Sitemap | Contact