javax.swing

Class ScrollPaneLayout

public class ScrollPaneLayout extends Object implements LayoutManager, ScrollPaneConstants, Serializable

ScrollPaneLayout
Nested Class Summary
static classScrollPaneLayout.UIResource
Field Summary
protected JViewportcolHead
protected JScrollBarhsb
protected inthsbPolicy
protected ComponentlowerLeft
protected ComponentlowerRight
protected JViewportrowHead
protected ComponentupperLeft
protected ComponentupperRight
protected JViewportviewport
protected JScrollBarvsb
protected intvsbPolicy
Constructor Summary
ScrollPaneLayout()
Method Summary
voidaddLayoutComponent(String key, Component component)
Add the specified component to the layout.
protected ComponentaddSingletonComponent(Component oldComponent, Component newComponent)
Removes an existing component.
JViewportgetColumnHeader()
ComponentgetCorner(String key)
Returns the Component at the specified corner.
JScrollBargetHorizontalScrollBar()
intgetHorizontalScrollBarPolicy()
JViewportgetRowHeader()
JScrollBargetVerticalScrollBar()
intgetVerticalScrollBarPolicy()
JViewportgetViewport()
RectanglegetViewportBorderBounds(JScrollPane scrollPane)
Returns the bounds of the border around a ScrollPane's viewport.
voidlayoutContainer(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
DimensionminimumLayoutSize(Container parent)
DimensionpreferredLayoutSize(Container parent)
voidremoveLayoutComponent(Component component)
voidsetHorizontalScrollBarPolicy(int policy)
Sets the horizontal scrollbar policy.
voidsetVerticalScrollBarPolicy(int policy)
Sets the vertical scrollbar policy.
voidsyncWithScrollPane(JScrollPane scrollPane)

Field Detail

colHead

protected JViewport colHead

hsb

protected JScrollBar hsb

hsbPolicy

protected int hsbPolicy

lowerLeft

protected Component lowerLeft

lowerRight

protected Component lowerRight

rowHead

protected JViewport rowHead

upperLeft

protected Component upperLeft

upperRight

protected Component upperRight

viewport

protected JViewport viewport

vsb

protected JScrollBar vsb

vsbPolicy

protected int vsbPolicy

Constructor Detail

ScrollPaneLayout

public ScrollPaneLayout()

Method Detail

addLayoutComponent

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

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

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

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.

getHorizontalScrollBar

public JScrollBar getHorizontalScrollBar()

getHorizontalScrollBarPolicy

public int getHorizontalScrollBarPolicy()

getRowHeader

public JViewport getRowHeader()

getVerticalScrollBar

public JScrollBar getVerticalScrollBar()

getVerticalScrollBarPolicy

public int getVerticalScrollBarPolicy()

getViewport

public JViewport getViewport()

getViewportBorderBounds

public Rectangle getViewportBorderBounds(JScrollPane scrollPane)

Deprecated: As of Swing 1.1 replaced by {@link javax.swing.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

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

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)

removeLayoutComponent

public void removeLayoutComponent(Component component)

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.

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.

syncWithScrollPane

public void syncWithScrollPane(JScrollPane scrollPane)