The ScrollPane class provides automatic scrolling of a child component.
public class java.awt.ScrollPane extends java.awt.Container { // Constants public final static int SCROLLBARS_ALWAYS; public final static int SCROLLBARS_AS_NEEDED; public final static int SCROLLBARS_NEVER; // Constructors public ScrollPane(); public ScrollPane (int scrollbarDisplayPolicy); // Public Instance Methods public void addNotify(); public void doLayout(); public Adjustable getHAdjustable(); public int getHScrollbarHeight(); public Point getScrollPosition(); public int getScrollbarDisplayPolicy(); public Adjustable getVAdjustable(); public int getVScrollbarWidth(); public Dimension getViewportSize(); public void layout(); public String paramString(); public void printComponents (Graphics g); public final void setLayout (LayoutManager mgr); public void setScrollPosition (int x, int y); public void setScrollPosition (Point p); //Protected Instance Methods protected final void addImpl (Component comp, Object constraints, int index); }
Always show the scrollbars.
Only show the scrollbars if the contents of the ScrollPane are larger than what is visible.
Don't ever show the scrollbars. The ScrollPane can still be scrolled programmatically.
Constructs a ScrollPane object with SCROLLBARS_AS_NEEDED.
One of the SCROLLBARS_ constants.
Constructs a ScrollPane object with the specified scrollbar display policy.
The component to add to the Scrollpane.
Layout constraints; ignored.
The position at which to add the component; should always be less than or equal to 0.
The component that was added.
Container.addImpl (Component, Object, int)
If pos is greater than 0.
Adds a child component to the Scrollpane. If there already was a child component, it is replaced by the new component.
Container.addNotify()
Creates ScrollPane's peer.
Container.doLayout()
Lays out the ScrollPane. Resizes the child component to its preferred size.
The object implementing the Adjustable interface that is used to adjust the ScrollPane horizontally. Usually this is a Scrollbar.
The height a horizontal scrollbar would occupy, regardless of whether it's shown or not.
Returns the position within the child component that is displayed at 0, 0 in the ScrollPane.
The display policy for the scrollbars (one of the SCROLLBARS_ constants).
The object implementing the Adjustable interface that is used to adjust the ScrollPane vertically. Usually this is a Scrollbar.
The width a vertical scrollbar would occupy, regardless of whether it's shown or not.
The size of the ScrollPane's port (the area of the child component that is shown).
Container.layout()
Lays out component. Replaced by doLayout().
String with current settings of ScrollPane.
Container.paramString()
Helper method for toString() to generate string of current settings.
Graphics context.
Container.printComponents(Graphics)
Prints the ScrollPane's child component.
Ignored.
Container.setLayout(LayoutManager)
Does nothing. No layout manager is needed because there is only one child component.
New horizontal position.
New vertical position.
If the point given is not valid.
Scroll to the given position in the child component.
New position.
If the point given is not valid.
Scroll to the given position in the child component.
Adjustable, Container, Point, Scrollbar