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
-
colHead
- The column-header component
-
hsb
- The horizontal scrollbar
-
hsbPolicy
- The display policy for the horizontal scrollbar.
-
lowerLeft
- The component at the lower left corner
-
lowerRight
- The component at the lower right corner
-
rowHead
- The row-header component
-
upperLeft
- The component at the upper left corner
-
upperRight
- The component at the upper right corner
-
viewport
- The JViewport that displays the pane's contents
-
vsb
- The vertical scrollbar
-
vsbPolicy
-
The display policy for the vertical scrollbar.
-
ScrollPaneLayout()
-
-
addLayoutComponent(String, Component)
- Adds the specified component to the layout, identifying it
as one of:
- ScrollPaneConstants.VIEWPORT
- ScrollPaneConstants.VERTICAL_SCROLLBAR
- ScrollPaneConstants.HORIZONTAL_SCROLLBAR
- ScrollPaneConstants.ROW_HEADER
- ScrollPaneConstants.COLUMN_HEADER
- ScrollPaneConstants.LOWER_LEFT_CORNER
- ScrollPaneConstants.LOWER_RIGHT_CORNER
- ScrollPaneConstants.UPPER_LEFT_CORNER
- ScrollPaneConstants.UPPER_RIGHT_CORNER
-
addSingletonComponent(Component, Component)
-
The method used to replace an existing component (if any) with a
new one.
-
getColumnHeader()
- Returns the column header component.
-
getCorner(String)
- Returns the component at the specified corner, where the
corner specification is one of:
- ScrollPaneConstants.LOWER_LEFT_CORNER
- ScrollPaneConstants.LOWER_RIGHT_CORNER
- ScrollPaneConstants.UPPER_LEFT_CORNER
- ScrollPaneConstants.UPPER_RIGHT_CORNER
-
getHorizontalScrollBar()
- Returns the horizontal scrollbar.
-
getHorizontalScrollBarPolicy()
- Returns the horizontal scrollbar-display policy.
-
getRowHeader()
- Returns the row header component.
-
getVerticalScrollBar()
- Returns the vertical scrollbar.
-
getVerticalScrollBarPolicy()
- Returns the vertical scrollbar-display policy.
-
getViewport()
- Returns the view port object.
-
getViewportBorderBounds(JScrollPane)
-
Returns the bounds of the border around the specified scroll pane's
viewport.
-
layoutContainer(Container)
-
Layout the scrollpane according to the following constraints:
- The row header, if present and visible, gets its preferred
height and the viewports width.
-
minimumLayoutSize(Container)
-
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.
-
preferredLayoutSize(Container)
-
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.
-
removeLayoutComponent(Component)
- Removes the specified component from the layout.
-
setHorizontalScrollBarPolicy(int)
- Returns the horizontal scrollbar-display policy, where the
options are:
- ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
- ScrollPaneConstants.HOTRIZONTAL_SCROLLBAR_NEVER
- ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
-
setVerticalScrollBarPolicy(int)
- Returns the vertical scrollbar-display policy, where the
options are:
- ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
- ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER
- ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
viewport
protected JViewport viewport
- The JViewport that displays the pane's contents
vsb
protected JScrollBar vsb
- The vertical scrollbar
hsb
protected JScrollBar hsb
- The horizontal scrollbar
rowHead
protected JViewport rowHead
- The row-header component
colHead
protected JViewport colHead
- The column-header component
lowerLeft
protected Component lowerLeft
- The component at the lower left corner
lowerRight
protected Component lowerRight
- The component at the lower right corner
upperLeft
protected Component upperLeft
- The component at the upper left corner
upperRight
protected Component upperRight
- The component at the upper right corner
vsbPolicy
protected int vsbPolicy
- The display policy for the vertical scrollbar.
Default = As Needed
hsbPolicy
protected int hsbPolicy
- The display policy for the horizontal scrollbar.
Default = As Needed
ScrollPaneLayout
public ScrollPaneLayout()
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
addLayoutComponent
public void addLayoutComponent(String s,
Component c)
- Adds the specified component to the layout, identifying it
as one of:
- ScrollPaneConstants.VIEWPORT
- ScrollPaneConstants.VERTICAL_SCROLLBAR
- ScrollPaneConstants.HORIZONTAL_SCROLLBAR
- ScrollPaneConstants.ROW_HEADER
- ScrollPaneConstants.COLUMN_HEADER
- ScrollPaneConstants.LOWER_LEFT_CORNER
- ScrollPaneConstants.LOWER_RIGHT_CORNER
- ScrollPaneConstants.UPPER_LEFT_CORNER
- ScrollPaneConstants.UPPER_RIGHT_CORNER
- Parameters:
- s - the component identifier
- comp - the the component to be added
removeLayoutComponent
public void removeLayoutComponent(Component c)
- Removes the specified component from the layout.
- Parameters:
- comp - the component to remove
getVerticalScrollBarPolicy
public int getVerticalScrollBarPolicy()
- Returns the vertical scrollbar-display policy.
- Returns:
- an int giving the display policy
- See Also:
- setVerticalScrollBarPolicy
setVerticalScrollBarPolicy
public void setVerticalScrollBarPolicy(int x)
- Returns the vertical scrollbar-display policy, where the
options are:
- ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
- ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER
- ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
- Parameters:
- x - an int giving the display policy
getHorizontalScrollBarPolicy
public int getHorizontalScrollBarPolicy()
- Returns the horizontal scrollbar-display policy.
- Returns:
- an int giving the display policy
- See Also:
- setHorizontalScrollBarPolicy
setHorizontalScrollBarPolicy
public void setHorizontalScrollBarPolicy(int x)
- Returns the horizontal scrollbar-display policy, where the
options are:
- ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
- ScrollPaneConstants.HOTRIZONTAL_SCROLLBAR_NEVER
- ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
- Parameters:
- x - an int giving the display policy
getViewport
public JViewport getViewport()
- Returns the view port object.
- Returns:
- the JViewport object that displays the scrollable contents
getHorizontalScrollBar
public JScrollBar getHorizontalScrollBar()
- Returns the horizontal scrollbar.
- Returns:
- the JScrollbar object that handles horizontal scrolling
getVerticalScrollBar
public JScrollBar getVerticalScrollBar()
- Returns the vertical scrollbar.
- Returns:
- the JScrollbar object that handles vertical scrolling
getRowHeader
public JViewport getRowHeader()
- Returns the row header component.
- Returns:
- the JViewport object that is the row header
getColumnHeader
public JViewport getColumnHeader()
- Returns the column header component.
- Returns:
- the JViewport object that is the column header
getCorner
public Component getCorner(String key)
- Returns the component at the specified corner, where the
corner specification is one of:
- ScrollPaneConstants.LOWER_LEFT_CORNER
- ScrollPaneConstants.LOWER_RIGHT_CORNER
- ScrollPaneConstants.UPPER_LEFT_CORNER
- ScrollPaneConstants.UPPER_RIGHT_CORNER
- Returns:
- the Component at the specified corner
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
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
layoutContainer
public void layoutContainer(Container parent)
- Layout the scrollpane according to the following constraints:
- The row header, if present and visible, gets its preferred
height and the viewports width.
- The column header, if present and visible, gets its preferred
width and the viewports height.
- If a vertical scrollbar is needed, i.e. if the viewports extent
height is smaller than its view height or if the displayPolicy
is ALWAYS, it's treated like the row header wrt it's dimensions and
it's made visible.
- If a horizontal scrollbar is needed it's treated like the
column header (and see the vertical scrollbar item).
- If the scrollpane has a non-null viewportBorder, then space
is allocated for that.
- The viewport gets the space available after accounting for
the previous constraints.
- The corner components, if provided, are aligned with the
ends of the scrollbars and headers. If there's a vertical
scrollbar the right corners appear, if there's a horizontal
scrollbar the lower corners appear, a row header gets left
corners and a column header gets upper corners.
- Parameters:
- parent - the Container to lay out
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