ScrollPaneLayout (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[LayoutManager](../../java/awt/LayoutManager.html "interface in java.awt"), [Serializable](../../../java.base/java/io/Serializable.html "interface in java.io"), [ScrollPaneConstants](ScrollPaneConstants.html "interface in javax.swing")

Direct Known Subclasses:

[ScrollPaneLayout.UIResource](ScrollPaneLayout.UIResource.html "class in javax.swing")


public class ScrollPaneLayout extends Object implements LayoutManager, ScrollPaneConstants, Serializable

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 has been added to the java.beans package. Please see XMLEncoder.

Since:

1.2

See Also:

JScrollPane, JViewport

Nested Classes

Modifier and Type Class Description
static class ScrollPaneLayout.UIResource The UI resource version of ScrollPaneLayout.

Fields

Modifier and Type Field 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.

Fields declared in interface javax.swing.ScrollPaneConstants

[COLUMN_HEADER](ScrollPaneConstants.html#COLUMN%5FHEADER), [HORIZONTAL_SCROLLBAR](ScrollPaneConstants.html#HORIZONTAL%5FSCROLLBAR), [HORIZONTAL_SCROLLBAR_ALWAYS](ScrollPaneConstants.html#HORIZONTAL%5FSCROLLBAR%5FALWAYS), [HORIZONTAL_SCROLLBAR_AS_NEEDED](ScrollPaneConstants.html#HORIZONTAL%5FSCROLLBAR%5FAS%5FNEEDED), [HORIZONTAL_SCROLLBAR_NEVER](ScrollPaneConstants.html#HORIZONTAL%5FSCROLLBAR%5FNEVER), [HORIZONTAL_SCROLLBAR_POLICY](ScrollPaneConstants.html#HORIZONTAL%5FSCROLLBAR%5FPOLICY), [LOWER_LEADING_CORNER](ScrollPaneConstants.html#LOWER%5FLEADING%5FCORNER), [LOWER_LEFT_CORNER](ScrollPaneConstants.html#LOWER%5FLEFT%5FCORNER), [LOWER_RIGHT_CORNER](ScrollPaneConstants.html#LOWER%5FRIGHT%5FCORNER), [LOWER_TRAILING_CORNER](ScrollPaneConstants.html#LOWER%5FTRAILING%5FCORNER), [ROW_HEADER](ScrollPaneConstants.html#ROW%5FHEADER), [UPPER_LEADING_CORNER](ScrollPaneConstants.html#UPPER%5FLEADING%5FCORNER), [UPPER_LEFT_CORNER](ScrollPaneConstants.html#UPPER%5FLEFT%5FCORNER), [UPPER_RIGHT_CORNER](ScrollPaneConstants.html#UPPER%5FRIGHT%5FCORNER), [UPPER_TRAILING_CORNER](ScrollPaneConstants.html#UPPER%5FTRAILING%5FCORNER), [VERTICAL_SCROLLBAR](ScrollPaneConstants.html#VERTICAL%5FSCROLLBAR), [VERTICAL_SCROLLBAR_ALWAYS](ScrollPaneConstants.html#VERTICAL%5FSCROLLBAR%5FALWAYS), [VERTICAL_SCROLLBAR_AS_NEEDED](ScrollPaneConstants.html#VERTICAL%5FSCROLLBAR%5FAS%5FNEEDED), [VERTICAL_SCROLLBAR_NEVER](ScrollPaneConstants.html#VERTICAL%5FSCROLLBAR%5FNEVER), [VERTICAL_SCROLLBAR_POLICY](ScrollPaneConstants.html#VERTICAL%5FSCROLLBAR%5FPOLICY), [VIEWPORT](ScrollPaneConstants.html#VIEWPORT)

Constructors

Constructor Description
ScrollPaneLayout()
Modifier and Type Method Description
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.
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 declared in class java.lang.Object

[clone](../../../java.base/java/lang/Object.html#clone%28%29), [equals](../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../java.base/java/lang/Object.html#finalize%28%29), [getClass](../../../java.base/java/lang/Object.html#getClass%28%29), [hashCode](../../../java.base/java/lang/Object.html#hashCode%28%29), [notify](../../../java.base/java/lang/Object.html#notify%28%29), [notifyAll](../../../java.base/java/lang/Object.html#notifyAll%28%29), [toString](../../../java.base/java/lang/Object.html#toString%28%29), [wait](../../../java.base/java/lang/Object.html#wait%28%29), [wait](../../../java.base/java/lang/Object.html#wait%28long%29), [wait](../../../java.base/java/lang/Object.html#wait%28long,int%29)