
 |
Chapter 19 java.awt Reference |
 |
ScrollPane 
Name
ScrollPane
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.
- Description
-
Constructs a ScrollPane object
with SCROLLBARS_AS_NEEDED.
- Parameters
-
- scrollbarDisplayPolicy
-
One of the SCROLLBARS_
constants.
- Description
-
Constructs a ScrollPane object
with the specified scrollbar display policy.
- Parameters
-
- comp
-
The component to add to the Scrollpane.
- constraints
-
Layout constraints; ignored.
- index
-
The position at which to add the component; should always be less than or equal to 0.
- Returns
-
The component that was added.
- Overrides
-
Container.addImpl (Component, Object, int)
- Throws
-
- IllegalArgumentException
-
If
pos is greater than 0.
- Description
-
Adds a child component to the Scrollpane. If there already was a child component, it is replaced
by the new component.
- Overrides
-
Container.addNotify()
- Description
-
Creates ScrollPane's peer.
- Overrides
-
Container.doLayout()
- Description
-
Lays out the ScrollPane. Resizes
the child component to its preferred size.
- Returns
-
The object implementing the Adjustable
interface that is used to adjust the ScrollPane
horizontally. Usually this is a Scrollbar.
- Returns
-
The height a horizontal scrollbar would occupy, regardless of whether it's
shown or not.
- Returns
-
Returns the position within the child component that is displayed at 0,
0 in the ScrollPane.
- Returns
-
The display policy for the scrollbars (one of the SCROLLBARS_
constants).
- Returns
-
The object implementing the Adjustable
interface that is used to adjust the ScrollPane
vertically. Usually this is a Scrollbar.
- Returns
-
The width a vertical scrollbar would occupy, regardless of whether it's
shown or not.
- Returns
-
The size of the ScrollPane's
port (the area of the child component that is shown).
- Overrides
-
Container.layout()
- Description
-
Lays out component. Replaced by doLayout().
- Returns
-
String with current settings of ScrollPane.
- Overrides
-
Container.paramString()
- Description
-
Helper method for toString()
to generate string of current settings.
- Parameters
-
- g
-
Graphics context.
- Overrides
-
Container.printComponents(Graphics)
- Description
-
Prints the ScrollPane's
child component.
- Parameters
-
- manager
-
Ignored.
- Overrides
-
Container.setLayout(LayoutManager)
- Description
-
Does nothing. No layout manager is needed because there is only one child
component.
- Parameters
-
- x
-
New horizontal position.
- y
-
New vertical position.
- Throws
-
- IllegalArgumentException
-
If
the point given is not valid.
- Description
-
Scroll to the given position in the child component.
- Parameters
-
- p
-
New position.
- Throws
-
- IllegalArgumentException
-
If
the point given is not valid.
- Description
-
Scroll to the given position in the child component.
Adjustable, Container,
Point, Scrollbar
|
|