This week's book giveaway is in the
We're giving away four copies of
and have Sam Newman on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Swing / AWT / SWT
Setting a scroll pane's scroll bar to the top after button click?
Joined: Jun 14, 2011
Nov 12, 2012 15:17:55
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
public void setViewport(JViewport jv) Removes the old viewport (if there is one); forces the viewPosition of the new viewport to be in the +x,+y quadrant; syncs up the row and column headers (if there are any) with the new viewport; and finally syncs the scrollbars and headers with the new viewport. Most applications will find it more convenient to use setViewportView to add a viewport and a view to the scrollpane. Parameters: viewport - the new viewport to be used; if viewport is null, the old viewport is still removed and the new viewport is set to null See Also: createViewport(), getViewport(), setViewportView(java.awt.Component)
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
Joined: Jun 19, 2012
Nov 13, 2012 01:15:41
is only about visible
- no idea what is your goal, even is possible dont do that,
- for todays
- basically you can to put whatever to the
with transparency too, but have to reduce caused flickering by using
viewPort.setScrollMode(JViewport.BLIT_SCROLL_MODE); viewPort.setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE); viewPort.setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
- have to override own
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Setting a scroll pane's scroll bar to the top after button click?
JTable and Horizontal Scroll Bar
JTextArea not appearing in JDialog
Can U Turn a JTable Sideways?
Problems when using JScrollPane to scroll JTextArea
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015