scrollbar : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

scrollbar

region on the screen the user can drag a thumbtab to scroll vertically or horizontally or both. In AWT (Advanced Windowing Toolkit) you get them by adding your Component to a ScrollPane then adding the ScrollPane to your Container. In Swing you use JScrollPane instead. JScrollPane works with a ScrollPaneLayout which as a side effect decides when the scrollbars are needed and which part of the image to display. To get the JScrollPane to notice that your Component has changed size, you must call the Component’s revalidate method. If scroll bars fail to appear, make sure your getPreferredSize, getMinimumSize and getMaximumSize methods on your extended JPanel inside the ScrollPane are producing the size of the full image, not just the visible part.

with JScrollPane, if you don’t specify the scrolling policy, this is the default:

// note vertical comes first
new JScrollPane ( component,
                  VERTICAL_SCROLLBAR_AS_NEEDED,
                  HORIZONAL_SCROLLBAR_AS_NEEDED );
You can control what is visible with by getting the horizonal or vertical JScrollBar and using setValue.

This page is posted
on the web at:

http://mindprod.com/jgloss/scrollbar.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\scrollbar.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.237.65.102]
You are visitor number