java.lang.Object javax.swing.ScrollPaneLayoutpublic class ScrollPaneLayout extends Object implements LayoutManager, ScrollPaneConstants, Serializable static class protected JScrollBar protected int protected Component protected Component protected JScrollBar protected int 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 void addLayoutComponent(String key, Component component)protected Component addSingletonComponent(Component oldComponent, Component newComponent) Rectangle getViewportBorderBounds(JScrollPane scrollPane)JScrollPane.getViewportBorderBounds(). void layoutContainer(Container parent) Dimension minimumLayoutSize(Container parent) Dimension preferredLayoutSize(Container parent) void removeLayoutComponent(Component component) void setHorizontalScrollBarPolicy(int policy) void setVerticalScrollBarPolicy(int policy) void syncWithScrollPane(JScrollPane scrollPane)protected JScrollBar hsb
protected int hsbPolicy
protected Component lowerRight
protected Component upperRight
protected JScrollBar vsb
protected int vsbPolicy
public ScrollPaneLayout()
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
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
public JViewport getColumnHeader()
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.
public JScrollBar getHorizontalScrollBar()
public int getHorizontalScrollBarPolicy()
public JViewport getRowHeader()
public JScrollBar getVerticalScrollBar()
public int getVerticalScrollBarPolicy()
public JViewport getViewport()
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
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
public Dimension minimumLayoutSize(Container parent)
- Specified by:
- minimumLayoutSize in interface LayoutManager
public Dimension preferredLayoutSize(Container parent)
- Specified by:
- preferredLayoutSize in interface LayoutManager
public void removeLayoutComponent(Component component)
- Specified by:
- removeLayoutComponent in interface LayoutManager
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.
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.
public void syncWithScrollPane(JScrollPane scrollPane)