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