• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree: Selected moved to top  RSS feed

 
Jerry Wolf
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTree has a scrollPathToVisible() method. It makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed.
How do I get the "node identified by the path" to display at the top of the JScrollPane?
 
Java Foolxxx
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I've the same problem: Any new ideas on this?
Thanks!
J.F.
 
Alex Ku
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe there is a better way, but here is my
thought:

getRowBounds return a Rectangle which is used to draw the row. getLocation return the position relative to the JTree. So, set the view position to that location will do what you want.
good lucky
kawaii
[ February 20, 2002: Message edited by: kawaii desu ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Foolxxx,

Please re-register with a user name that follows the Official JavaRanch User Name Guidelines. Your username is required not to be an obviously fake name...

Thanks,
-Nate
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!