Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt

Class ScrollPane

java.lang.Object
|
+--java.awt.Component
   |
   +--java.awt.Container
      |
      +--java.awt.ScrollPane

All Implemented Interfaces:

Accessible, ImageObserver, MenuContainer, Serializable


public class ScrollPane

extends Container

implements Accessible

This widget provides a scrollable region that allows a single subcomponent to be viewed through a smaller window.

Author:

Field Summary

static intSCROLLBARS_ALWAYS

Constant indicating that scrollbars are always displayed in this window.
static intSCROLLBARS_AS_NEEDED

Constant indicating that scrollbars are created as needed in this windows.
static intSCROLLBARS_NEVER

Constant indicating that scrollbars are never displayed in this window.

Constructor Summary

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.

Method Summary

voidaddImpl(java.awt.Component component, java.lang.Object constraints, int index)

Adds the specified child component to this container.
voidaddNotify()

Notifies this object that it should create its native peer.
voiddoLayout()

Lays out this component.
java.awt.AdjustablegetHAdjustable()

Returns the horizontal scrollbar for this object.
intgetHScrollbarHeight()

Returns the height of a horizontal scrollbar.
java.awt.PointgetScrollPosition()

Returns the current scroll position of the viewport.
intgetScrollbarDisplayPolicy()

Returns the current scrollbar display policy.
java.awt.AdjustablegetVAdjustable()

Returns the vertical scrollbar for this object.
intgetVScrollbarWidth()

Returns the width of a vertical scrollbar.
java.awt.DimensiongetViewportSize()

Returns the current viewport size.
voidlayout()

Lays out this component.
java.lang.StringparamString()

Returns a debug string for this object.
voidprintComponents(java.awt.Graphics graphics)

Prints all of the components in this container.
voidremoveNotify()

Notifies this object that it should destroy its native peers.
voidsetLayout(java.awt.LayoutManager layoutManager)

This method overrides its superclass method to ensure no layout manager is set for this container.
voidsetScrollPosition(java.awt.Point scrollPosition)

Sets the scroll position to the specified value.
voidsetScrollPosition(int x, int y)

Sets the scroll position to the specified value.

Field Details

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.


Constructor Details

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:


Method Details

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:


getHScrollbarHeight

public int getHScrollbarHeight()

Returns the height of a horizontal scrollbar.

Returns:


getScrollPosition

public Point getScrollPosition()

Returns the current scroll position of the viewport.

Returns:


getScrollbarDisplayPolicy

public int getScrollbarDisplayPolicy()

Returns the current scrollbar display policy.

Returns:


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:


getVScrollbarWidth

public int getVScrollbarWidth()

Returns the width of a vertical scrollbar.

Returns:


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:


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: