|
JSR-209 (Final Release) | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.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 JavaBeansTM
has been added to the java.beans
package.
Please see java.beans.XMLEncoder
.
JScrollPane
,
JViewport
Field Summary | |
protected JViewport |
colHead
The column header child. |
protected JScrollBar |
hsb
The scrollpane's horizontal scrollbar child. |
protected java.awt.Component |
lowerLeft
The component to display in the lower left corner. |
protected java.awt.Component |
lowerRight
The component to display in the lower right corner. |
protected JViewport |
rowHead
The row header child. |
protected java.awt.Component |
upperLeft
The component to display in the upper left corner. |
protected java.awt.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. |
Constructor Summary | |
ScrollPaneLayout()
The display policy for the horizontal scrollbar. |
Method Summary | |
void |
addLayoutComponent(java.lang.String s,
java.awt.Component c)
Adds the specified component to the layout. |
protected java.awt.Component |
addSingletonComponent(java.awt.Component oldC,
java.awt.Component newC)
Removes an existing component. |
JViewport |
getColumnHeader()
Returns the JViewport object that is the column header. |
java.awt.Component |
getCorner(java.lang.String key)
Returns the Component at the specified corner. |
JScrollBar |
getHorizontalScrollBar()
Returns the JScrollBar object that handles horizontal scrolling. |
JViewport |
getRowHeader()
Returns the JViewport object that is the row header. |
JScrollBar |
getVerticalScrollBar()
Returns the JScrollBar object that handles vertical scrolling. |
JViewport |
getViewport()
Returns the JViewport object that displays the
scrollable contents. |
void |
layoutContainer(java.awt.Container parent)
Lays out the scrollpane. |
Dimension |
minimumLayoutSize(java.awt.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(java.awt.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(java.awt.Component c)
Removes the specified component from the layout. |
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
JViewport
.
JScrollPane.setViewport(javax.swing.JViewport)
protected JScrollBar vsb
JScrollBar
.
JScrollPane.setVerticalScrollBar(javax.swing.JScrollBar)
protected JScrollBar hsb
JScrollBar
.
JScrollPane.setHorizontalScrollBar(javax.swing.JScrollBar)
protected JViewport rowHead
null
.
JScrollPane.setRowHeader(javax.swing.JViewport)
protected JViewport colHead
null
.
JScrollPane.setColumnHeader(javax.swing.JViewport)
protected java.awt.Component lowerLeft
null
.
JScrollPane.setCorner(java.lang.String, java.awt.Component)
protected java.awt.Component lowerRight
null
.
JScrollPane.setCorner(java.lang.String, java.awt.Component)
protected java.awt.Component upperLeft
null
.
JScrollPane.setCorner(java.lang.String, java.awt.Component)
protected java.awt.Component upperRight
null
.
JScrollPane.setCorner(java.lang.String, java.awt.Component)
Constructor Detail |
public ScrollPaneLayout()
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED
.
This field is obsolete, please use the JScrollPane
field instead.
JScrollPane.setHorizontalScrollBarPolicy(int)
Method Detail |
public void syncWithScrollPane(JScrollPane sp)
JScrollPane
.
It initializes all of the internal fields that
are ordinarily set by addLayoutComponent
. For example:
ScrollPaneLayout mySPLayout = new ScrollPanelLayout() { public void layoutContainer(Container p) { super.layoutContainer(p); // do some extra work here ... } }; scrollpane.setLayout(mySPLayout):
protected java.awt.Component addSingletonComponent(java.awt.Component oldC, java.awt.Component newC)
This method returns newC
. If oldC
is
not equal to newC
and is non-null
,
it will be removed from its parent.
oldC
- the Component
to replacenewC
- the Component
to add
newC
public void addLayoutComponent(java.lang.String s, java.awt.Component c)
addLayoutComponent
in interface java.awt.LayoutManager
s
- the component identifierc
- the the component to be added
java.lang.IllegalArgumentException
- if s
is an invalid keypublic void removeLayoutComponent(java.awt.Component c)
removeLayoutComponent
in interface java.awt.LayoutManager
c
- the component to removepublic JViewport getViewport()
JViewport
object that displays the
scrollable contents.
JViewport
object that displays the scrollable contentsJScrollPane.getViewport()
public JScrollBar getHorizontalScrollBar()
JScrollBar
object that handles horizontal scrolling.
JScrollBar
object that handles horizontal scrollingJScrollPane.getHorizontalScrollBar()
public JScrollBar getVerticalScrollBar()
JScrollBar
object that handles vertical scrolling.
JScrollBar
object that handles vertical scrollingJScrollPane.getVerticalScrollBar()
public JViewport getRowHeader()
JViewport
object that is the row header.
JViewport
object that is the row headerJScrollPane.getRowHeader()
public JViewport getColumnHeader()
JViewport
object that is the column header.
JViewport
object that is the column headerJScrollPane.getColumnHeader()
public java.awt.Component getCorner(java.lang.String key)
Component
at the specified corner.
key
- the String
specifying the corner
Component
at the specified corner, as defined in
ScrollPaneConstants
; if key
is not one of the
four corners, null
is returnedJScrollPane.getCorner(java.lang.String)
public Dimension preferredLayoutSize(java.awt.Container parent)
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.
Note that the rowHeader is calculated as part of the preferred width and the colHeader is calculated as part of the preferred size.
preferredLayoutSize
in interface java.awt.LayoutManager
parent
- the Container
that will be laid out
Dimension
object specifying the preferred size of the
viewport and any scrollbarsViewportLayout
,
LayoutManager
public Dimension minimumLayoutSize(java.awt.Container parent)
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.
minimumLayoutSize
in interface java.awt.LayoutManager
parent
- the Container
that will be laid out
Dimension
object specifying the minimum sizepublic void layoutContainer(java.awt.Container parent)
displayPolicy
is ALWAYS, it's treated like the row header with respect to its
dimensions and is made visible.
null
viewportBorder
, then space is allocated for that.
layoutContainer
in interface java.awt.LayoutManager
parent
- the Container
to lay out
|
JSR-209 (Final Release) | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |