java.awt.ScrollPane (JDK 1.1)
This Container class creates horizontal and vertical scrollbars surrounding a "viewport" and allows a single child component to be displayed and scrolled within this viewport. Typically the child of the ScrollPane is larger than the ScrollPane itself, so scrollbars allow the user to select the currently visible portion.
When you call the ScrollPane() constructor, you may optionally specify a scrollbar display policy, which should be one of the three constants defined by this class. If you do not specify a policy, ScrollPane uses the SCROLLBARS_AS_NEEDED policy.
A program can programmatically scroll the child within the viewport by calling setScrollPosition(). getHAdjustable() and getVAdjustable() return the horizontal and vertical Adjustable objects that control scrolling (typically these are not actually instances of Scrollbar). You can use these Adjustable objects to specify the unit and block increment values for the scrollbars. You can also directly set the Adjustable value, as an alternative to setScrollPosition(), but should not set other values of the Adjustable objects.
Use setSize() to set the size of the ScrollPane container. You may want to take the size of the scrollbars into account when computing the overall container size--use getHScrollbarHeight() and getVScrollbarWidth() to obtain these values.
ScrollPane overrides the printComponents() method of Container so that when a ScrollPane is printed, the entire child component is printed, rather than only the currently visible portion.
public classScrollPaneextends Container { //Public ConstructorspublicScrollPane(); publicScrollPane(intscrollbarDisplayPolicy); //Constantspublic static final intSCROLLBARS_ALWAYS; public static final intSCROLLBARS_AS_NEEDED; public static final intSCROLLBARS_NEVER; //Public Instance Methodspublic voidaddNotify(); //Overrides Containerpublic voiddoLayout(); //Overrides Containerpublic AdjustablegetHAdjustable(); public intgetHScrollbarHeight(); public PointgetScrollPosition(); public intgetScrollbarDisplayPolicy(); public AdjustablegetVAdjustable(); public intgetVScrollbarWidth(); public DimensiongetViewportSize(); # public voidlayout(); //Overrides Containerpublic StringparamString(); //Overrides Containerpublic voidprintComponents(Graphicsg); //Overrides Containerpublic final voidsetLayout(LayoutManagermgr); //Overrides Containerpublic voidsetScrollPosition(intx, inty); public voidsetScrollPosition(Pointp); //Protected Instance Methodsprotected final voidaddImpl(Componentcomp, Objectconstraints, intindex); //Overrides Container}
Hierarchy:
Object->Component(ImageObserver, MenuContainer, Serializable)->Container->ScrollPane
Passed To:
Toolkit.createScrollPane()