Two Laptop Bag*
The moose likes Swing / AWT / SWT and the fly likes Setting a scroll pane's scroll bar to the top after button click? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Setting a scroll pane Watch "Setting a scroll pane New topic
Author

Setting a scroll pane's scroll bar to the top after button click?

Jay Orsaw
Ranch Hand

Joined: Jun 14, 2011
Posts: 356

Okay so I have a program that resets the icons, and sets rid of a scroll bar when it resets. Now I also want it to goto the top. I believe that has to do with the viewport? I was looking at this



Any hep would be appreciated, thanks!


EDIT: Figured it out... using setViewportView and then setting the component as my panel and getting it @ the point 0,0
m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 154
- JViewport is only about visible Rectange from JScrollPane

- no idea what is your goal, even is possible dont do that, JViewport isnt JComponent or Container too

- for todays Java ot use JLayer (Java7) based on JXLayer (Java6)

- basically you can to put whatever to the JViewport with transparency too, but have to reduce caused flickering by using



- have to override own RepaintManager too
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting a scroll pane's scroll bar to the top after button click?
 
Similar Threads
JTable and Horizontal Scroll Bar
JScrollBar/JScrollPane
Can U Turn a JTable Sideways?
Problems when using JScrollPane to scroll JTextArea
JTextArea not appearing in JDialog