Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how can u send the JScrollbar back to the top  RSS feed

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to reposition the JScrollBar
to the top of the JScrollPane once the user
leaves the pane. Because the way things stand
now once the user returns to the JScrollPane
the JSrollBar is still at the same position it
was left at; prior to exiting
Does anyone have a solution
Thank u for your time

------------------
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might try this and see if it works for you. I have a JPanel in a JScrollPane and this is what I use to position it where I need it.
myScrollPane.getViewport().setViewPosition(new Point(0, 0));


------------------
Happy Coding,
Gregg Bolinger
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two years later, it was exactly what I was searching for. Thx Gregg, this place is great
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!