java.awt
Class ScrollPane
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.ScrollPane
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable
This widget provides a scrollable region that allows a single
subcomponent to be viewed through a smaller window.
Author:- Aaron M. Renn (arenn@urbanophile.com)
SCROLLBARS_ALWAYS
public static final int SCROLLBARS_ALWAYS
Constant indicating that scrollbars are always displayed in this
window.
SCROLLBARS_AS_NEEDED
public static final int SCROLLBARS_AS_NEEDED
Constant indicating that scrollbars are created as needed in this
windows.
SCROLLBARS_NEVER
public static final int SCROLLBARS_NEVER
Constant indicating that scrollbars are never displayed in this window.
ScrollPane
public ScrollPane()
Initializes a new instance of ScrollPane
with a default
scrollbar policy of SCROLLBARS_AS_NEEDED
.
Throws:
ScrollPane
public ScrollPane(int scrollbarDisplayPolicy)
Initializes a new instance of ScrollPane
with the
specified scrollbar policy.
Parameters:
Throws:
addImpl
public final void addImpl(java.awt.Component component, java.lang.Object constraints, int index)
Adds the specified child component to this container. A
ScrollPane
can have at most one child, so if a second
one is added, then first one is removed.
Parameters:
addNotify
public void addNotify()
Notifies this object that it should create its native peer.
doLayout
public void doLayout()
Lays out this component. This consists of resizing the sole child
component to its perferred size.
getHAdjustable
public Adjustable getHAdjustable()
Returns the horizontal scrollbar for this object. If the scrollbar
display policy is set to SCROLLBARS_NEVER
then this
will be null
.
Returns:
- The horizontal scrollbar for this window.
getHScrollbarHeight
public int getHScrollbarHeight()
Returns the height of a horizontal scrollbar.
Returns:
- The height of a horizontal scrollbar.
getScrollPosition
public Point getScrollPosition()
Returns the current scroll position of the viewport.
Returns:
- The current scroll position of the viewport.
getScrollbarDisplayPolicy
public int getScrollbarDisplayPolicy()
Returns the current scrollbar display policy.
Returns:
- The current scrollbar display policy.
getVAdjustable
public Adjustable getVAdjustable()
Returns the vertical scrollbar for this object. If the scrollbar
display policy is set to SCROLLBARS_NEVER
then this
will be null
.
Returns:
- The horizontal scrollbar for this window.
getVScrollbarWidth
public int getVScrollbarWidth()
Returns the width of a vertical scrollbar.
Returns:
- The width of a vertical scrollbar.
getViewportSize
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:
layout
public void layout()
Lays out this component. This consists of resizing the sole child
component to its perferred size.
paramString
public String paramString()
Returns a debug string for this object.
Returns:
- A debug string for this object.
printComponents
public void printComponents(java.awt.Graphics graphics)
Prints all of the components in this container.
Parameters:
removeNotify
public void removeNotify()
Notifies this object that it should destroy its native peers.
setLayout
public final void setLayout(java.awt.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:
setScrollPosition
public void setScrollPosition(int x, int y)
Sets the scroll position to the specified value.
Parameters:
Throws:
setScrollPosition
public void setScrollPosition(java.awt.Point scrollPosition)
Sets the scroll position to the specified value.
Parameters:
Throws: