JScrollPane.
ScrollPaneLayout 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
has been added to the java.beans package.
Please see java..
JScrollPane, JViewport
| Modifier and Type | Class and Description |
|---|---|
| public static class | ScrollPaneLayout.
The UI resource version of |
| Modifier and Type | Field and Description |
|---|---|
| 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. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addLayoutComponent(String
the component identifier s, Component the component to be added c)Implements java. Adds the specified component to the layout. |
| protected Component | Returns: thenewCthe oldC, Component Component to replacethe newC)Component to addRemoves an existing component. |
| private void | adjustForHSB(boolean wantsHSB, Rectangle available, Rectangle hsbR, Insets vpbInsets)
Adjusts the |
| private void | adjustForVSB(boolean wantsVSB, Rectangle available, Rectangle vsbR, Insets vpbInsets, boolean leftToRight)
Adjusts the |
| public JViewport | Returns: theJViewport object that is the column headerReturns the |
| public Component | Returns: theComponent at the specified corner, as defined in
ScrollPaneConstants; if key is not one of the
four corners, null is returnedthe key)String specifying the cornerReturns the |
| public JScrollBar | Returns: theJScrollBar object that handles horizontal scrollingReturns the |
| public int | Returns: an integer giving the display policyReturns the horizontal scrollbar-display policy. |
| public JViewport | Returns: theJViewport object that is the row headerReturns the |
| public JScrollBar | Returns: theJScrollBar object that handles vertical scrollingReturns the |
| public int | Returns: an integer giving the display policyReturns the vertical scrollbar-display policy. |
| public JViewport | Returns: theJViewport object that displays the scrollable contentsReturns the |
| public Rectangle | Returns: the size and position of the viewport borderan instance of the scrollpane)JScrollPane
Deprecated
As of JDK version Swing1.1
replaced by
JScrollPane.getViewportBorderBounds().
Returns the bounds of the border around the specified scroll pane's viewport. |
| public void | layoutContainer(Container
the parent)Container to lay outImplements java. Lays out the scrollpane. |
| public Dimension | Returns: aDimension object specifying the minimum sizethe parent)Container that will be laid outImplements java. The minimum size of a |
| public Dimension | Returns: aDimension object specifying the preferred size of the
viewport and any scrollbarsthe parent)Container that will be laid outImplements java. The preferred size of a |
| public void | removeLayoutComponent(Component
the component to remove c)Implements java. Removes the specified component from the layout. |
| public void | setHorizontalScrollBarPolicy(int
an int giving the display policy x)Sets the horizontal scrollbar-display policy. |
| public void | setVerticalScrollBarPolicy(int
an integer giving the display policy x)Sets the vertical scrollbar-display policy. |
| public void | syncWithScrollPane(JScrollPane
an instance of the sp)JScrollPaneThis method is invoked after the ScrollPaneLayout is set as the
LayoutManager of a |
| colHead | back to summary |
|---|---|
| protected JViewport colHead The column header child. Default is
| |
| hsb | back to summary |
|---|---|
| protected JScrollBar hsb The scrollpane's horizontal scrollbar child.
Default is a
| |
| hsbPolicy | back to summary |
|---|---|
| protected int hsbPolicy The display policy for the horizontal scrollbar.
The default is
This field is obsolete, please use the | |
| lowerLeft | back to summary |
|---|---|
| protected Component lowerLeft The component to display in the lower left corner.
Default is
| |
| lowerRight | back to summary |
|---|---|
| protected Component lowerRight The component to display in the lower right corner.
Default is
| |
| rowHead | back to summary |
|---|---|
| protected JViewport rowHead The row header child. Default is
| |
| upperLeft | back to summary |
|---|---|
| protected Component upperLeft The component to display in the upper left corner.
Default is
| |
| upperRight | back to summary |
|---|---|
| protected Component upperRight The component to display in the upper right corner.
Default is
| |
| viewport | back to summary |
|---|---|
| protected JViewport viewport The scrollpane's viewport child.
Default is an empty
| |
| vsb | back to summary |
|---|---|
| protected JScrollBar vsb The scrollpane's vertical scrollbar child.
Default is a
| |
| vsbPolicy | back to summary |
|---|---|
| protected int vsbPolicy The display policy for the vertical scrollbar.
The default is
This field is obsolete, please use the | |
| ScrollPaneLayout | back to summary |
|---|---|
| public ScrollPaneLayout() Constructs a | |
| addLayoutComponent | back to summary |
|---|---|
| public void addLayoutComponent(String s, Component c) Implements java. Adds the specified component to the layout. The layout is identified using one of:
| |
| addSingletonComponent | back to summary |
|---|---|
| protected Component addSingletonComponent(Component oldC, Component newC) Removes an existing component. When a new component, such as the left corner, or vertical scrollbar, is added, the old one, if it exists, must be removed.
This method returns | |
| adjustForHSB | back to summary |
|---|---|
| private void adjustForHSB(boolean wantsHSB, Rectangle available, Rectangle hsbR, Insets vpbInsets) Adjusts the | |
| adjustForVSB | back to summary |
|---|---|
| private void adjustForVSB(boolean wantsVSB, Rectangle available, Rectangle vsbR, Insets vpbInsets, boolean leftToRight) Adjusts the | |
| getColumnHeader | back to summary |
|---|---|
| public JViewport getColumnHeader() Returns the
| |
| getCorner | back to summary |
|---|---|
| public Component getCorner(String key) Returns the
| |
| getHorizontalScrollBar | back to summary |
|---|---|
| public JScrollBar getHorizontalScrollBar() Returns the
| |
| getHorizontalScrollBarPolicy | back to summary |
|---|---|
| public int getHorizontalScrollBarPolicy() Returns the horizontal scrollbar-display policy.
| |
| getRowHeader | back to summary |
|---|---|
| public JViewport getRowHeader() Returns the
| |
| getVerticalScrollBar | back to summary |
|---|---|
| public JScrollBar getVerticalScrollBar() Returns the
| |
| getVerticalScrollBarPolicy | back to summary |
|---|---|
| public int getVerticalScrollBarPolicy() Returns the vertical scrollbar-display policy.
| |
| getViewport | back to summary |
|---|---|
| public JViewport getViewport() Returns the
| |
| getViewportBorderBounds | back to summary |
|---|---|
| public Rectangle getViewportBorderBounds(JScrollPane scrollpane)
Deprecated As of JDK version Swing1.1
replaced by Returns the bounds of the border around the specified scroll pane's viewport.
| |
| layoutContainer | back to summary |
|---|---|
| public void layoutContainer(Container parent) Implements java. Lays out the scrollpane. The positioning of components depends on the following constraints:
| |
| minimumLayoutSize | back to summary |
|---|---|
| public Dimension minimumLayoutSize(Container parent) Implements java. The minimum size of a | |
| preferredLayoutSize | back to summary |
|---|---|
| public Dimension preferredLayoutSize(Container parent) Implements java. The preferred size of a Note that the rowHeader is calculated as part of the preferred width and the colHeader is calculated as part of the preferred size.
| |
| removeLayoutComponent | back to summary |
|---|---|
| public void removeLayoutComponent(Component c) Implements java. Removes the specified component from the layout.
| |
| setHorizontalScrollBarPolicy | back to summary |
|---|---|
| public void setHorizontalScrollBarPolicy(int x) Sets the horizontal scrollbar-display policy. The options are:
JScrollPane version
of this method. It only exists for backwards compatibility
with the Swing 1.0.2 (and earlier) versions of this class.
| |
| setVerticalScrollBarPolicy | back to summary |
|---|---|
| public void setVerticalScrollBarPolicy(int x) Sets the vertical scrollbar-display policy. The options are:
JScrollPane version
of this method. It only exists for backwards compatibility
with the Swing 1.0.2 (and earlier) versions of this class.
| |
| syncWithScrollPane | back to summary |
|---|---|
| public void syncWithScrollPane(JScrollPane sp) This method is invoked after the ScrollPaneLayout is set as the
LayoutManager of a
ScrollPaneLayout mySPLayout = new ScrollPanelLayout() {
public void layoutContainer(Container p) {
super.layoutContainer(p);
// do some extra work here ...
}
};
scrollpane.setLayout(mySPLayout):
| |
ScrollPaneLayout.
| Access | Constructor and Description |
|---|---|
| public |
| UIResource | back to summary |
|---|---|
| public UIResource() Constructs a | |