Java Glossary : scrollbar

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : S words : scrollbar.

scrollbar
region on the screen the user can drag a thumbtab to scroll vertically or horizontally or both. In AWT 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 );


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 1367.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/scrollbar.html J:\mindprod\jgloss\scrollbar.html