This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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: 174
- 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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Setting a scroll pane's scroll bar to the top after button click?
 
It's not a secret anymore!