javax.swing
Class ScrollPaneLayout

java.lang.Object
  extended by javax.swing.ScrollPaneLayout
All Implemented Interfaces:
LayoutManager, Serializable, ScrollPaneConstants
Direct Known Subclasses:
ScrollPaneLayout.UIResource

public class ScrollPaneLayout
extends Object
implements LayoutManager, ScrollPaneConstants, Serializable

ScrollPaneLayout

See Also:
Serialized Form

Nested Class Summary
static class ScrollPaneLayout.UIResource
           
 
Field Summary
protected  JViewport colHead
           
protected  JScrollBar hsb
           
protected  int hsbPolicy
           
protected  Component lowerLeft
           
protected  Component lowerRight
           
protected  JViewport rowHead
           
protected  Component upperLeft
           
protected  Component upperRight
           
protected  JViewport viewport
           
protected  JScrollBar vsb
           
protected  int vsbPolicy
           
 
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Constructor Summary
ScrollPaneLayout()
           
 
Method Summary
 void addLayoutComponent(String key, Component component)
          Add the specified component to the layout.
protected  Component addSingletonComponent(Component oldComponent, Component newComponent)
          Removes an existing component.
 JViewport getColumnHeader()
           
 Component getCorner(String key)
          Returns the Component at the specified corner.
 JScrollBar getHorizontalScrollBar()
           
 int getHorizontalScrollBarPolicy()
           
 JViewport getRowHeader()
           
 JScrollBar getVerticalScrollBar()
           
 int getVerticalScrollBarPolicy()
           
 JViewport getViewport()
           
 Rectangle getViewportBorderBounds(JScrollPane scrollPane)
          Deprecated. As of Swing 1.1 replaced by JScrollPane.getViewportBorderBounds().
 void layoutContainer(Container parent)
          +----+--------------------+----+ y1 | c1 | column header | c2 | +----+--------------------+----+ y2 | r | | v | | o | | | | w | | s | | | | r | | h | | o | | e | viewport | l | | a | | l | | d | | b | | e | | a | | r | | r | +----+--------------------+----+ y3 | c3 | h scrollbar | c4 | +----+--------------------+----+ y4 x1 x2 x3 x4
 Dimension minimumLayoutSize(Container parent)
          Calculates the minimum size for this container, taking into account the components it contains.
 Dimension preferredLayoutSize(Container parent)
          Calculates the preferred size for this container, taking into account the components it contains.
 void removeLayoutComponent(Component component)
          Removes the specified component from the layout group.
 void setHorizontalScrollBarPolicy(int policy)
          Sets the horizontal scrollbar policy.
 void setVerticalScrollBarPolicy(int policy)
          Sets the vertical scrollbar policy.
 void syncWithScrollPane(JScrollPane scrollPane)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

viewport

protected JViewport viewport

vsb

protected JScrollBar vsb

hsb

protected JScrollBar hsb

rowHead

protected JViewport rowHead

colHead

protected JViewport colHead

lowerLeft

protected Component lowerLeft

lowerRight

protected Component lowerRight

upperLeft

protected Component upperLeft

upperRight

protected Component upperRight

vsbPolicy

protected int vsbPolicy

hsbPolicy

protected int hsbPolicy
Constructor Detail

ScrollPaneLayout

public ScrollPaneLayout()
Method Detail

syncWithScrollPane

public void syncWithScrollPane(JScrollPane scrollPane)

addSingletonComponent

protected Component addSingletonComponent(Component oldComponent,
                                          Component newComponent)
Removes an existing component. If oldComponent is not null and is not equal to newComponent, oldComponent must be removed from its parent.

Parameters:
oldComponent - the old Component that may need to be removed.
newComponent - the Component to add.
Returns:
the newComponent

addLayoutComponent

public void addLayoutComponent(String key,
                               Component component)
Add the specified component to the layout.

Specified by:
addLayoutComponent in interface LayoutManager
Parameters:
key - must be one of VIEWPORT, VERTICAL_SCROLLBAR, HORIZONTAL_SCROLLBAR, ROW_HEADER, COLUMN_HEADER, LOWER_RIGHT_CORNER, LOWER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_LEFT_CORNER.
component - the Component to add
Throws:
IllegalArgumentException - if key is not as above

removeLayoutComponent

public void removeLayoutComponent(Component component)
Description copied from interface: LayoutManager
Removes the specified component from the layout group.

Specified by:
removeLayoutComponent in interface LayoutManager
Parameters:
component - the component to remove

getVerticalScrollBarPolicy

public int getVerticalScrollBarPolicy()

setVerticalScrollBarPolicy

public void setVerticalScrollBarPolicy(int policy)
Sets the vertical scrollbar policy.

Parameters:
policy - must be one of VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_ALWAYS.
Throws:
IllegalArgumentException - if policy is not one of the valid JScrollBar policies.

getHorizontalScrollBarPolicy

public int getHorizontalScrollBarPolicy()

setHorizontalScrollBarPolicy

public void setHorizontalScrollBarPolicy(int policy)
Sets the horizontal scrollbar policy.

Parameters:
policy - must be one of HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_ALWAYS.
Throws:
IllegalArgumentException - if policy is not one of the valid JScrollbar policies.

getViewport

public JViewport getViewport()

getHorizontalScrollBar

public JScrollBar getHorizontalScrollBar()

getVerticalScrollBar

public JScrollBar getVerticalScrollBar()

getRowHeader

public JViewport getRowHeader()

getColumnHeader

public JViewport getColumnHeader()

getCorner

public Component getCorner(String key)
Returns the Component at the specified corner.

Parameters:
key - the corner.
Returns:
the Component at the specified corner, or null if key is not one of the four valid corners.

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Description copied from interface: LayoutManager
Calculates the preferred size for this container, taking into account the components it contains.

Specified by:
preferredLayoutSize in interface LayoutManager
Parameters:
parent - the parent container to lay out
Returns:
the preferred dimensions of this container
See Also:
LayoutManager.minimumLayoutSize(Container)

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Description copied from interface: LayoutManager
Calculates the minimum size for this container, taking into account the components it contains.

Specified by:
minimumLayoutSize in interface LayoutManager
Parameters:
parent - the parent container to lay out
Returns:
the minimum dimensions of this container
See Also:
LayoutManager.preferredLayoutSize(Container)

layoutContainer

public void layoutContainer(Container parent)
+----+--------------------+----+ y1 | c1 | column header | c2 | +----+--------------------+----+ y2 | r | | v | | o | | | | w | | s | | | | r | | h | | o | | e | viewport | l | | a | | l | | d | | b | | e | | a | | r | | r | +----+--------------------+----+ y3 | c3 | h scrollbar | c4 | +----+--------------------+----+ y4 x1 x2 x3 x4

Specified by:
layoutContainer in interface LayoutManager
Parameters:
parent - the container to lay out

getViewportBorderBounds

public Rectangle getViewportBorderBounds(JScrollPane scrollPane)
Deprecated. As of Swing 1.1 replaced by JScrollPane.getViewportBorderBounds().

Returns the bounds of the border around a ScrollPane's viewport.

Parameters:
scrollPane - the ScrollPane for which's viewport the border is requested