<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.awt.ScrollPane
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.html">This Package</a>  <a href="java.awt.Rectangle.html#_top_">Previous</a>  <a href="java.awt.Scrollbar.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.awt.ScrollPane
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.awt.Component.html#_top_">java.awt.Component</a>
           |
           +----<a href="java.awt.Container.html#_top_">java.awt.Container</a>
                   |
                   +----java.awt.ScrollPane
</pre>
<hr>
<dl>
  <dt> public class <b>ScrollPane</b>
  <dt> extends <a href="java.awt.Container.html#_top_">Container</a>
</dl>
A container class which implements automatic horizontal and/or
 vertical scrolling for a single child component.  The display
 policy for the scrollbars can be set to:
 <OL>
 <LI>as needed: scrollbars created and shown only when needed by scrollpane
 <LI>always: scrollbars created and always shown by the scrollpane
 <LI>never: scrollbars never created or shown by the scrollpane
 </OL>
 <P>
 The state of the horizontal and vertical scrollbars is represented
 by two objects (one for each dimension) which implement the
 Adjustable interface.  The API provides methods to access those
 objects such that the attributes on the Adjustable object (such as unitIncrement,
 value, etc.) can be manipulated.
 <P>
 Certain adjustable properties (minimum, maximum, blockIncrement,
 and visibleAmount) are set internally by the scrollpane in accordance
 with the geometry of the scrollpane and its child and these should
 not be set by programs using the scrollpane.
 <P>
 If the scrollbar display policy is defined as "never", then the
 scrollpane can still be programmatically scrolled using the 
 setScrollPosition() method and the scrollpane will move and clip
 the child's contents appropriately.  This policy is useful if the
 program needs to create and manage its own adjustable controls.
 <P>
 The placement of the scrollbars is controlled by platform-specific
 properties set by the user outside of the program.
 <P>
 The initial size of this container is set to 100x100, but can
 be reset using setSize(). 
 <P>
 Insets are used to define any space used by scrollbars and any
 borders created by the scroll pane. getInsets() can be used
 to get the current value for the insets.  If the value of 
 scrollbarsAlwaysVisible is false, then the value of the insets
 will change dynamically depending on whether the scrollbars are
 currently visible or not.
<p>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#SCROLLBARS_ALWAYS"><b>SCROLLBARS_ALWAYS</b></a>
  <dd>  Specifies that horizontal/vertical scrollbars should always be
 shown regardless of the respective sizes of the scrollpane and child.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#SCROLLBARS_AS_NEEDED"><b>SCROLLBARS_AS_NEEDED</b></a>
  <dd>  Specifies that horizontal/vertical scrollbar should be shown 
 only when the size of the child exceeds the size of the scrollpane
 in the horizontal/vertical dimension.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#SCROLLBARS_NEVER"><b>SCROLLBARS_NEVER</b></a>
  <dd>  Specifies that horizontal/vertical scrollbars should never be shown
 regardless of the respective sizes of the scrollpane and child.
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ScrollPane()"><b>ScrollPane</b></a>()
  <dd>  Create a new scrollpane container with a scrollbar display policy of
 "as needed".
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ScrollPane(int)"><b>ScrollPane</b></a>(int)
  <dd>  Create a new scrollpane container.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addImpl(java.awt.Component, java.lang.Object, int)"><b>addImpl</b></a>(Component, Object, int)
  <dd> 
 Adds the specified component to this scroll pane container.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addNotify()"><b>addNotify</b></a>()
  <dd>  Creates the scroll pane's peer.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#doLayout()"><b>doLayout</b></a>()
  <dd>  Lays out this container by resizing its child to its preferred size.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getHAdjustable()"><b>getHAdjustable</b></a>()
  <dd>  Returns the Adjustable object which represents the state of
 the horizontal scrollbar.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getHScrollbarHeight()"><b>getHScrollbarHeight</b></a>()
  <dd>  Returns the height that would be occupied by a horizontal
 scrollbar, which is independent of whether it is currently
 displayed by the scroll pane or not.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getScrollbarDisplayPolicy()"><b>getScrollbarDisplayPolicy</b></a>()
  <dd>  Returns the display policy for the scrollbars.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getScrollPosition()"><b>getScrollPosition</b></a>()
  <dd>  Returns the current x,y position within the child which is displayed 
 at the 0,0 location of the scrolled panel's view port.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getVAdjustable()"><b>getVAdjustable</b></a>()
  <dd>  Returns the Adjustable object which represents the state of
 the vertical scrollbar.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getViewportSize()"><b>getViewportSize</b></a>()
  <dd>  Returns the current size of the scroll pane's view port.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getVScrollbarWidth()"><b>getVScrollbarWidth</b></a>()
  <dd>  Returns the width that would be occupied by a vertical
 scrollbar, which is independent of whether it is currently
 displayed by the scroll pane or not.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#layout()"><b>layout</b></a>()
  <dd> 
 
<b>Deprecated.</b>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#paramString()"><b>paramString</b></a>()
  <dd>  Returns the parameter string representing the state of this 
 container.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#printComponents(java.awt.Graphics)"><b>printComponents</b></a>(Graphics)
  <dd> 
 Prints the component in this scroll pane.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setLayout(java.awt.LayoutManager)"><b>setLayout</b></a>(LayoutManager)
  <dd> 
 Sets the layout manager for this container.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setScrollPosition(int, int)"><b>setScrollPosition</b></a>(int, int)
  <dd>  Scrolls to the specified position within the child component.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setScrollPosition(java.awt.Point)"><b>setScrollPosition</b></a>(Point)
  <dd>  Scrolls to the specified position within the child component.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="SCROLLBARS_AS_NEEDED"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>SCROLLBARS_AS_NEEDED</b>
<pre>
 public static final int SCROLLBARS_AS_NEEDED
</pre>
<dl>
  <dd> Specifies that horizontal/vertical scrollbar should be shown 
 only when the size of the child exceeds the size of the scrollpane
 in the horizontal/vertical dimension.<p>
</dl>
<a name="SCROLLBARS_ALWAYS"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>SCROLLBARS_ALWAYS</b>
<pre>
 public static final int SCROLLBARS_ALWAYS
</pre>
<dl>
  <dd> Specifies that horizontal/vertical scrollbars should always be
 shown regardless of the respective sizes of the scrollpane and child.<p>
</dl>
<a name="SCROLLBARS_NEVER"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>SCROLLBARS_NEVER</b>
<pre>
 public static final int SCROLLBARS_NEVER
</pre>
<dl>
  <dd> Specifies that horizontal/vertical scrollbars should never be shown
 regardless of the respective sizes of the scrollpane and child.<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="ScrollPane"></a>
<a name="ScrollPane()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>ScrollPane</b>
<pre>
 public ScrollPane()
</pre>
<dl>
  <dd> Create a new scrollpane container with a scrollbar display policy of
 "as needed".
<p>
</dl>
<a name="ScrollPane(int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>ScrollPane</b>
<pre>
 public ScrollPane(int scrollbarDisplayPolicy)
</pre>
<dl>
  <dd> Create a new scrollpane container.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> scrollbarDisplayPolicy - policy for when scrollbars should be shown
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="addImpl(java.awt.Component, java.lang.Object, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addImpl"><b>addImpl</b></a>
<pre>
 protected final void addImpl(<a href="java.awt.Component.html#_top_">Component</a> comp,
                              <a href="java.lang.Object.html#_top_">Object</a> constraints,
                              int index)
</pre>
<dl>
  <dd> Adds the specified component to this scroll pane container.
 If the scroll pane has an existing child component, that
 component is removed and the new one is added.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> comp - the component to be added
    <dd> constraints - not applicable
    <dd> index - position of child component (must be <= 0)
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Container.html#addImpl(java.awt.Component, java.lang.Object, int)">addImpl</a> in class <a href="java.awt.Container.html#_top_">Container</a>
  </dl></dd>
</dl>
<a name="getScrollbarDisplayPolicy()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getScrollbarDisplayPolicy"><b>getScrollbarDisplayPolicy</b></a>
<pre>
 public int getScrollbarDisplayPolicy()
</pre>
<dl>
  <dd> Returns the display policy for the scrollbars.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the display policy for the scrollbars
  </dl></dd>
</dl>
<a name="getViewportSize()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getViewportSize"><b>getViewportSize</b></a>
<pre>
 public <a href="java.awt.Dimension.html#_top_">Dimension</a> getViewportSize()
</pre>
<dl>
  <dd> Returns the current size of the scroll pane's view port.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the size of the view port in pixels
  </dl></dd>
</dl>
<a name="getHScrollbarHeight()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getHScrollbarHeight"><b>getHScrollbarHeight</b></a>
<pre>
 public int getHScrollbarHeight()
</pre>
<dl>
  <dd> Returns the height that would be occupied by a horizontal
 scrollbar, which is independent of whether it is currently
 displayed by the scroll pane or not.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the height of a horizontal scrollbar in pixels
  </dl></dd>
</dl>
<a name="getVScrollbarWidth()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getVScrollbarWidth"><b>getVScrollbarWidth</b></a>
<pre>
 public int getVScrollbarWidth()
</pre>
<dl>
  <dd> Returns the width that would be occupied by a vertical
 scrollbar, which is independent of whether it is currently
 displayed by the scroll pane or not.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the width of a vertical scrollbar in pixels
  </dl></dd>
</dl>
<a name="getVAdjustable()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getVAdjustable"><b>getVAdjustable</b></a>
<pre>
 public <a href="java.awt.Adjustable.html#_top_">Adjustable</a> getVAdjustable()
</pre>
<dl>
  <dd> Returns the Adjustable object which represents the state of
 the vertical scrollbar. If the scrollbar display policy is "never",
 this method returns null.
<p>
</dl>
<a name="getHAdjustable()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getHAdjustable"><b>getHAdjustable</b></a>
<pre>
 public <a href="java.awt.Adjustable.html#_top_">Adjustable</a> getHAdjustable()
</pre>
<dl>
  <dd> Returns the Adjustable object which represents the state of
 the horizontal scrollbar.  If the scrollbar display policy is "never",
 this method returns null.
<p>
</dl>
<a name="setScrollPosition(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setScrollPosition"><b>setScrollPosition</b></a>
<pre>
 public void setScrollPosition(int x,
                               int y)
</pre>
<dl>
  <dd> Scrolls to the specified position within the child component.
 A call to this method is only valid if the scroll pane contains
 a child.  Specifying a position outside of the legal scrolling bounds
 of the child will scroll to the closest legal position.  
 Legal bounds are defined to be the rectangle: 
 x = 0, y = 0, width = (child width - view port width),
 height = (child height - view port height).
 This is a convenience method which interfaces with the Adjustable
 objects which represent the state of the scrollbars.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> x - the x position to scroll to
    <dd> y - the y position to scroll to
    <dt> <b>Throws:</b> <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
    <dd> if specified coordinates are
 not within the legal scrolling bounds of the child component.
  </dl></dd>
</dl>
<a name="setScrollPosition(java.awt.Point)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setScrollPosition"><b>setScrollPosition</b></a>
<pre>
 public void setScrollPosition(<a href="java.awt.Point.html#_top_">Point</a> p)
</pre>
<dl>
  <dd> Scrolls to the specified position within the child component.
 A call to this method is only valid if the scroll pane contains
 a child and the specified position is within legal scrolling bounds
 of the child.  Legal bounds are defined to be the rectangle: 
 x = 0, y = 0, width = (child width - view port width),
 height = (child height - view port height).
 This is a convenience method which interfaces with the Adjustable
 objects which represent the state of the scrollbars.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> p - the Point representing the position to scroll to
    <dt> <b>Throws:</b> <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
    <dd> if specified coordinates are
 not within the legal scrolling bounds of the child component.
  </dl></dd>
</dl>
<a name="getScrollPosition()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getScrollPosition"><b>getScrollPosition</b></a>
<pre>
 public <a href="java.awt.Point.html#_top_">Point</a> getScrollPosition()
</pre>
<dl>
  <dd> Returns the current x,y position within the child which is displayed 
 at the 0,0 location of the scrolled panel's view port.
 This is a convenience method which interfaces with the adjustable
 objects which represent the state of the scrollbars.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the coordinate position for the current scroll position
  </dl></dd>
</dl>
<a name="setLayout(java.awt.LayoutManager)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setLayout"><b>setLayout</b></a>
<pre>
 public final void setLayout(<a href="java.awt.LayoutManager.html#_top_">LayoutManager</a> mgr)
</pre>
<dl>
  <dd> Sets the layout manager for this container.  This method is
 overridden to prevent the layout mgr from being set.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> mgr - the specified layout manager
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Container.html#setLayout(java.awt.LayoutManager)">setLayout</a> in class <a href="java.awt.Container.html#_top_">Container</a>
  </dl></dd>
</dl>
<a name="doLayout()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="doLayout"><b>doLayout</b></a>
<pre>
 public void doLayout()
</pre>
<dl>
  <dd> Lays out this container by resizing its child to its preferred size.
 If the new preferred size of the child causes the current scroll
 position to be invalid, the scroll position is set to the closest
 valid position.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Container.html#doLayout()">doLayout</a> in class <a href="java.awt.Container.html#_top_">Container</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#validate">validate</a>
  </dl></dd>
</dl>
<a name="layout()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="layout"><b>layout</b></a>
<pre>
 public void layout()
</pre>
<dl>
<dd><b> Note: layout() is deprecated.</b>
<i>As of JDK version 1.1,
 replaced by <code>doLayout()</code>.</i>
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Container.html#layout()">layout</a> in class <a href="java.awt.Container.html#_top_">Container</a>
  </dl></dd>
</dl>
<a name="printComponents(java.awt.Graphics)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="printComponents"><b>printComponents</b></a>
<pre>
 public void printComponents(<a href="java.awt.Graphics.html#_top_">Graphics</a> g)
</pre>
<dl>
  <dd> Prints the component in this scroll pane.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> g - the specified Graphics window
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Container.html#printComponents(java.awt.Graphics)">printComponents</a> in class <a href="java.awt.Container.html#_top_">Container</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#print">print</a>, <a href="java.awt.Component.html#printAll">printAll</a>
  </dl></dd>
</dl>
<a name="addNotify()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addNotify"><b>addNotify</b></a>
<pre>
 public void addNotify()
</pre>
<dl>
  <dd> Creates the scroll pane's peer.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Container.html#addNotify()">addNotify</a> in class <a href="java.awt.Container.html#_top_">Container</a>
  </dl></dd>
</dl>
<a name="paramString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="paramString"><b>paramString</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> paramString()
</pre>
<dl>
  <dd> Returns the parameter string representing the state of this 
 container.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Container.html#paramString()">paramString</a> in class <a href="java.awt.Container.html#_top_">Container</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.html">This Package</a>  <a href="java.awt.Rectangle.html#_top_">Previous</a>  <a href="java.awt.Scrollbar.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
