public class ScrollPane extends Container implements Accessible
| Modifier and Type | Class and Description |
|---|---|
protected class |
ScrollPane.AccessibleAWTScrollPane |
Container.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
SCROLLBARS_ALWAYS
Constant indicating that scrollbars are always displayed in this
window.
|
static int |
SCROLLBARS_AS_NEEDED
Constant indicating that scrollbars are created as needed in this
windows.
|
static int |
SCROLLBARS_NEVER
Constant indicating that scrollbars are never displayed in this window.
|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
ScrollPane()
Initializes a new instance of
ScrollPane with a default
scrollbar policy of SCROLLBARS_AS_NEEDED. |
ScrollPane(int scrollbarDisplayPolicy)
Initializes a new instance of
ScrollPane with the
specified scrollbar policy. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addImpl(Component component,
Object constraints,
int index)
Adds the specified child component to this container.
|
void |
addNotify()
Notifies this object that it should create its native peer.
|
void |
doLayout()
Lays out this component.
|
protected boolean |
eventTypeEnabled(int type)
Tells whether or not an event is enabled.
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this
ScrollPane. |
Adjustable |
getHAdjustable()
Returns the horizontal scrollbar for this object.
|
int |
getHScrollbarHeight()
Returns the height of a horizontal scrollbar.
|
int |
getScrollbarDisplayPolicy()
Returns the current scrollbar display policy.
|
Point |
getScrollPosition()
Returns the current scroll position of the viewport.
|
Adjustable |
getVAdjustable()
Returns the vertical scrollbar for this object.
|
Dimension |
getViewportSize()
Returns the current viewport size.
|
int |
getVScrollbarWidth()
Returns the width of a vertical scrollbar.
|
boolean |
isWheelScrollingEnabled()
Tells whether or not wheel scrolling is enabled.
|
void |
layout()
Deprecated.
This method is deprecated in favor of
doLayout(). |
String |
paramString()
Returns a debug string for this object.
|
void |
printComponents(Graphics graphics)
Prints all of the components in this container.
|
void |
removeNotify()
Notifies this object that it should destroy its native peers.
|
void |
setLayout(LayoutManager layoutManager)
This method overrides its superclass method to ensure no layout
manager is set for this container.
|
void |
setScrollPosition(int x,
int y)
Sets the scroll position to the specified value.
|
void |
setScrollPosition(Point scrollPosition)
Sets the scroll position to the specified value.
|
void |
setWheelScrollingEnabled(boolean enable)
Enables/disables wheel scrolling.
|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, update, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int SCROLLBARS_AS_NEEDED
public static final int SCROLLBARS_ALWAYS
public static final int SCROLLBARS_NEVER
public ScrollPane()
ScrollPane with a default
scrollbar policy of SCROLLBARS_AS_NEEDED.HeadlessException - If GraphicsEnvironment.isHeadless() is true.public ScrollPane(int scrollbarDisplayPolicy)
ScrollPane with the
specified scrollbar policy.scrollbarDisplayPolicy - When to display scrollbars, which must
be one of the constants defined in this class.HeadlessException - If GraphicsEnvironment.isHeadless() is true.public int getScrollbarDisplayPolicy()
public Adjustable getHAdjustable()
SCROLLBARS_NEVER then this
will be null.public Adjustable getVAdjustable()
SCROLLBARS_NEVER then this
will be null.public Dimension getViewportSize()
public int getHScrollbarHeight()
public int getVScrollbarWidth()
public Point getScrollPosition()
NullPointerException - if the scrollpane does have a child.public void setScrollPosition(Point scrollPosition) throws IllegalArgumentException
scrollPosition - The new scrollPosition.IllegalArgumentException - If the specified value is outside
the legal scrolling range.public void setScrollPosition(int x, int y)
x - The new X coordinate of the scroll position.y - The new Y coordinate of the scroll position.NullPointerException - if scrollpane does not have a child.IllegalArgumentException - If the specified value is outside
the legal scrolling range.public void addNotify()
addNotify in class ContainerComponent.isDisplayable(),
Component.removeNotify()public void removeNotify()
removeNotify in class ContainerComponent.isDisplayable(),
Component.addNotify()protected final void addImpl(Component component, Object constraints, int index)
ScrollPane can have at most one child, so if a second
one is added, then first one is removed.public void doLayout()
doLayout in class ContainerComponent.validate(),
LayoutManagerpublic void layout()
doLayout().public final void setLayout(LayoutManager layoutManager)
ScrollPane's do
not have layout managers.public void printComponents(Graphics graphics)
printComponents in class Containergraphics - The desired graphics context for printing.public String paramString()
paramString in class Containerprotected boolean eventTypeEnabled(int type)
type - The event id to check.true if a listener for the event id exists or
if the eventMask is set for the event id.Component.eventTypeEnabled(int)public boolean isWheelScrollingEnabled()
public void setWheelScrollingEnabled(boolean enable)
public AccessibleContext getAccessibleContext()
ScrollPane.
The context is created, if necessary.getAccessibleContext in interface AccessiblegetAccessibleContext in class Component