public class ScrollPaneLayout extends Object implements LayoutManager, ScrollPaneConstants, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
ScrollPaneLayout.UIResource |
Modifier and Type | Field and Description |
---|---|
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 |
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 and Description |
---|
ScrollPaneLayout() |
Modifier and Type | Method and Description |
---|---|
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) |
protected JScrollBar vsb
protected JScrollBar hsb
protected Component lowerRight
protected Component upperRight
protected int vsbPolicy
protected int hsbPolicy
public ScrollPaneLayout()
public void syncWithScrollPane(JScrollPane scrollPane)
protected Component addSingletonComponent(Component oldComponent, Component newComponent)
oldComponent
- the old Component that may need to be removed.newComponent
- the Component to add.public void addLayoutComponent(String key, Component component)
addLayoutComponent
in interface LayoutManager
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 addIllegalArgumentException
- if key is not as abovepublic void removeLayoutComponent(Component component)
LayoutManager
removeLayoutComponent
in interface LayoutManager
component
- the component to removepublic int getVerticalScrollBarPolicy()
public void setVerticalScrollBarPolicy(int policy)
policy
- must be one of VERTICAL_SCROLLBAR_AS_NEEDED,
VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_ALWAYS.IllegalArgumentException
- if policy is not one of the valid
JScrollBar policies.public int getHorizontalScrollBarPolicy()
public void setHorizontalScrollBarPolicy(int policy)
policy
- must be one of HORIZONTAL_SCROLLBAR_AS_NEEDED,
HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_ALWAYS.IllegalArgumentException
- if policy is not one of the valid
JScrollbar policies.public JViewport getViewport()
public JScrollBar getHorizontalScrollBar()
public JScrollBar getVerticalScrollBar()
public JViewport getRowHeader()
public JViewport getColumnHeader()
public Component getCorner(String key)
key
- the corner.public Dimension preferredLayoutSize(Container parent)
LayoutManager
preferredLayoutSize
in interface LayoutManager
parent
- the parent container to lay outLayoutManager.minimumLayoutSize(Container)
public Dimension minimumLayoutSize(Container parent)
LayoutManager
minimumLayoutSize
in interface LayoutManager
parent
- the parent container to lay outLayoutManager.preferredLayoutSize(Container)
public void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
parent
- the container to lay outpublic Rectangle getViewportBorderBounds(JScrollPane scrollPane)
JScrollPane.getViewportBorderBounds()
.scrollPane
- the ScrollPane for which's viewport the border
is requested