java.lang.Object javax.swing.ScrollPaneLayout
public class ScrollPaneLayout
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 applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans TM has been added to the java.beans package. Please see XMLEncoder .
Nested Class Summary | |
---|---|
static class |
ScrollPaneLayout.UIResource
The UI resource version of ScrollPaneLayout. |
Field Summary | |
---|---|
protected JViewport |
colHead
The column header child. |
protected JScrollBar |
hsb
The scrollpane's horizontal scrollbar child. |
protected int |
hsbPolicy
The display policy for the horizontal scrollbar. |
protected Component |
lowerLeft
The component to display in the lower left corner. |
protected Component |
lowerRight
The component to display in the lower right corner. |
protected JViewport |
rowHead
The row header child. |
protected Component |
upperLeft
The component to display in the upper left corner. |
protected Component |
upperRight
The component to display in the upper right corner. |
protected JViewport |
viewport
The scrollpane's viewport child. |
protected JScrollBar |
vsb
The scrollpane's vertical scrollbar child. |
protected int |
vsbPolicy
The display policy for the vertical scrollbar. |
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
s,
Component
c) Adds the specified component to the layout. |
protected Component |
addSingletonComponent
(
Component
oldC,
Component
newC) Removes an existing component. |
JViewport |
getColumnHeader
() Returns the JViewport object that is the column header. |
Component |
getCorner
(
String
key) Returns the Component at the specified corner. |
JScrollBar |
getHorizontalScrollBar
() Returns the JScrollBar object that handles horizontal scrolling. |
int |
getHorizontalScrollBarPolicy
() Returns the horizontal scrollbar-display policy. |
JViewport |
getRowHeader
() Returns the JViewport object that is the row header. |
JScrollBar |
getVerticalScrollBar
() Returns the JScrollBar object that handles vertical scrolling. |
int |
getVerticalScrollBarPolicy
() Returns the vertical scrollbar-display policy. |
JViewport |
getViewport
() Returns the JViewport object that displays the scrollable contents. |
Rectangle |
getViewportBorderBounds
(
JScrollPane
scrollpane) Deprecated. As of JDK version Swing1.1 replaced by JScrollPane.getViewportBorderBounds(). |
void |
layoutContainer
(
Container
parent) Lays out the scrollpane. |
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. |
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. |
void |
removeLayoutComponent
(
Component
c) Removes the specified component from the layout. |
void |
setHorizontalScrollBarPolicy
(int x) Sets the horizontal scrollbar-display policy. |
void |
setVerticalScrollBarPolicy
(int x) Sets the vertical scrollbar-display policy. |
void |
syncWithScrollPane
(
JScrollPane
sp) This method is invoked after the ScrollPaneLayout is set as the LayoutManager of a JScrollPane. |
Methods inherited from class java.lang. Object |
---|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Field Detail |
---|
protected JViewport viewport
protected JScrollBar vsb
protected JScrollBar hsb
protected JViewport rowHead
protected JViewport colHead
protected Component lowerLeft
protected Component lowerRight
protected Component upperLeft
protected Component upperRight
protected int vsbPolicy
This field is obsolete, please use the JScrollPane field instead.
protected int hsbPolicy
This field is obsolete, please use the JScrollPane field instead.
Constructor Detail |
---|
public ScrollPaneLayout()
Method Detail |
---|
public void syncWithScrollPane(JScrollPane sp)
ScrollPaneLayout mySPLayout = new ScrollPanelLayout() { public void layoutContainer(Container p) { super.layoutContainer(p); // do some extra work here ... } }; scrollpane.setLayout(mySPLayout):
protected Component addSingletonComponent(Component oldC, Component newC)
This method returns newC. If oldC is not equal to newC and is non-null, it will be removed from its parent.
public void addLayoutComponent(String s, Component c)
public void removeLayoutComponent(Component c)
public int getVerticalScrollBarPolicy()
public void setVerticalScrollBarPolicy(int x)
public int getHorizontalScrollBarPolicy()
public void setHorizontalScrollBarPolicy(int x)
public JViewport getViewport()
public JScrollBar getHorizontalScrollBar()
public JScrollBar getVerticalScrollBar()
public JViewport getRowHeader()
public JViewport getColumnHeader()
public Component getCorner(String key)
public Dimension preferredLayoutSize(Container parent)
Note that the rowHeader is calculated as part of the preferred width and the colHeader is calculated as part of the preferred size.
public Dimension minimumLayoutSize(Container parent)
public void layoutContainer(Container parent)
@Deprecated public Rectangle getViewportBorderBounds(JScrollPane scrollpane)