All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.ScrollPaneLayout

java.lang.Object
   |
   +----com.sun.java.swing.ScrollPaneLayout

public class ScrollPaneLayout
extends Object
implements LayoutManager, ScrollPaneConstants, Serializable
The layout manager used by JScrollPane. JScrollPaneLayout is responsible for nine components: a viewport, two scrollbars, a row header, a column header, and four "corner" components.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
JScrollPane, JViewport

Variable Index

 o colHead
The column-header component
 o hsb
The horizontal scrollbar
 o hsbPolicy
The display policy for the horizontal scrollbar.
 o lowerLeft
The component at the lower left corner
 o lowerRight
The component at the lower right corner
 o rowHead
The row-header component
 o upperLeft
The component at the upper left corner
 o upperRight
The component at the upper right corner
 o viewport
The JViewport that displays the pane's contents
 o vsb
The vertical scrollbar
 o vsbPolicy
The display policy for the vertical scrollbar.

Constructor Index

 o ScrollPaneLayout()

Method Index

 o addLayoutComponent(String, Component)
Adds the specified component to the layout, identifying it as one of:
 o addSingletonComponent(Component, Component)
The method used to replace an existing component (if any) with a new one.
 o getColumnHeader()
Returns the column header component.
 o getCorner(String)
Returns the component at the specified corner, where the corner specification is one of:
 o getHorizontalScrollBar()
Returns the horizontal scrollbar.
 o getHorizontalScrollBarPolicy()
Returns the horizontal scrollbar-display policy.
 o getRowHeader()
Returns the row header component.
 o getVerticalScrollBar()
Returns the vertical scrollbar.
 o getVerticalScrollBarPolicy()
Returns the vertical scrollbar-display policy.
 o getViewport()
Returns the view port object.
 o getViewportBorderBounds(JScrollPane)
Returns the bounds of the border around the specified scroll pane's viewport.
 o layoutContainer(Container)
Layout the scrollpane according to the following constraints:

Variables

 o viewport
 protected JViewport viewport
The JViewport that displays the pane's contents

 o vsb
 protected JScrollBar vsb
The vertical scrollbar

 o hsb
 protected JScrollBar hsb
The horizontal scrollbar

 o rowHead
 protected JViewport rowHead
The row-header component

 o colHead
 protected JViewport colHead
The column-header component

 o lowerLeft
 protected Component lowerLeft
The component at the lower left corner

 o lowerRight
 protected Component lowerRight
The component at the lower right corner

 o upperLeft
 protected Component upperLeft
The component at the upper left corner

 o upperRight
 protected Component upperRight
The component at the upper right corner

 o vsbPolicy
 protected int vsbPolicy
The display policy for the vertical scrollbar. Default = As Needed

 o hsbPolicy
 protected int hsbPolicy
The display policy for the horizontal scrollbar. Default = As Needed

Constructors

 o ScrollPaneLayout
 public ScrollPaneLayout()

Methods

 o addSingletonComponent
 protected Component addSingletonComponent(Component oldC,
                                           Component newC)
The method used to replace an existing component (if any) with a new one. Used to add each different kind of component to a JScrollPane, since there can be one and only one left corner, vertical scrollbar, and so on. So only one of each subcomponent is allowed, the old one is removed (if it exists) when a new one is added.

Parameters:
oldC - the Component to replace
newC - the Component to add
 o addLayoutComponent
 public void addLayoutComponent(String s,
                                Component c)
Adds the specified component to the layout, identifying it as one of:

Parameters:
s - the component identifier
comp - the the component to be added
 o removeLayoutComponent
 public void removeLayoutComponent(Component c)
Removes the specified component from the layout.

Parameters:
comp - the component to remove
 o getVerticalScrollBarPolicy
 public int getVerticalScrollBarPolicy()
Returns the vertical scrollbar-display policy.

Returns:
an int giving the display policy
See Also:
setVerticalScrollBarPolicy
 o setVerticalScrollBarPolicy
 public void setVerticalScrollBarPolicy(int x)
Returns the vertical scrollbar-display policy, where the options are:

Parameters:
x - an int giving the display policy
 o getHorizontalScrollBarPolicy
 public int getHorizontalScrollBarPolicy()
Returns the horizontal scrollbar-display policy.

Returns:
an int giving the display policy
See Also:
setHorizontalScrollBarPolicy
 o setHorizontalScrollBarPolicy
 public void setHorizontalScrollBarPolicy(int x)
Returns the horizontal scrollbar-display policy, where the options are:

Parameters:
x - an int giving the display policy
 o getViewport
 public JViewport getViewport()
Returns the view port object.

Returns:
the JViewport object that displays the scrollable contents
 o getHorizontalScrollBar
 public JScrollBar getHorizontalScrollBar()
Returns the horizontal scrollbar.

Returns:
the JScrollbar object that handles horizontal scrolling
 o getVerticalScrollBar
 public JScrollBar getVerticalScrollBar()
Returns the vertical scrollbar.

Returns:
the JScrollbar object that handles vertical scrolling
 o getRowHeader
 public JViewport getRowHeader()
Returns the row header component.

Returns:
the JViewport object that is the row header
 o getColumnHeader
 public JViewport getColumnHeader()
Returns the column header component.

Returns:
the JViewport object that is the column header
 o getCorner
 public Component getCorner(String key)
Returns the component at the specified corner, where the corner specification is one of:

Returns:
the Component at the specified corner
 o preferredLayoutSize
 public Dimension preferredLayoutSize(Container parent)
The preferred size of a ScrollPane is the size of the insets, plus the preferred size of the viewport, plus the preferred size of the visible headers, plus the preferred size of the scrollbars that will appear given the current view and the current scrollbar displayPolicies.

Parameters:
parent - the Container that will be laid out
Returns:
a Dimension object specifying the preferred size of the viewport and any scrollbars.
See Also:
ViewportLayout, LayoutManager
 o minimumLayoutSize
 public Dimension minimumLayoutSize(Container parent)
The minimum size of a ScrollPane is the size of the insets plus minimum size of the viewport, plus the scrollpane's viewportBorder insets, plus the minimum size of the visible headers, plus the minimum size of the scrollbars whose displayPolicy isn't NEVER.

Parameters:
parent - the Container that will be laid out
Returns:
a Dimension object specifying the minimum size
 o layoutContainer
 public void layoutContainer(Container parent)
Layout the scrollpane according to the following constraints:

Parameters:
parent - the Container to lay out
 o getViewportBorderBounds
 public Rectangle getViewportBorderBounds(JScrollPane sp)
Returns the bounds of the border around the specified scroll pane's viewport.

Returns:
a Rectangle containing the size and position of the viewport border

All Packages  Class Hierarchy  This Package  Previous  Next  Index