javax.swing

Class ScrollPaneLayout

Implemented Interfaces:
LayoutManager, ScrollPaneConstants, Serializable
Known Direct Subclasses:
ScrollPaneLayout.UIResource

public class ScrollPaneLayout
extends Object
implements LayoutManager, ScrollPaneConstants, Serializable

ScrollPaneLayout
See Also:
Serialized Form

Nested Class Summary

static class
ScrollPaneLayout.UIResource

Field Summary

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

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 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)
Dimension
preferredLayoutSize(Container parent)
void
removeLayoutComponent(Component component)
void
setHorizontalScrollBarPolicy(int policy)
Sets the horizontal scrollbar policy.
void
setVerticalScrollBarPolicy(int policy)
Sets the vertical scrollbar policy.
void
syncWithScrollPane(JScrollPane scrollPane)

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

colHead

protected JViewport colHead

hsb

protected JScrollBar hsb

hsbPolicy

protected int hsbPolicy

lowerLeft

protected Component lowerLeft

lowerRight

protected Component lowerRight

rowHead

protected JViewport rowHead

upperLeft

protected Component upperLeft

upperRight

protected Component upperRight

viewport

protected JViewport viewport

vsb

protected JScrollBar vsb

vsbPolicy

protected int vsbPolicy

Constructor Details

ScrollPaneLayout

public ScrollPaneLayout()

Method Details

addLayoutComponent

public void addLayoutComponent(String key,
                               Component component)
Add the specified component to the layout.
Specified by:
addLayoutComponent in interface LayoutManager
Parameters:
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 add
Throws:
IllegalArgumentException - if key is not as above

addSingletonComponent

protected Component addSingletonComponent(Component oldComponent,
                                          Component newComponent)
Removes an existing component. If oldComponent is not null and is not equal to newComponent, oldComponent must be removed from its parent.
Parameters:
oldComponent - the old Component that may need to be removed.
newComponent - the Component to add.
Returns:
the newComponent

getColumnHeader

public JViewport getColumnHeader()

getCorner

public Component getCorner(String key)
Returns the Component at the specified corner.
Parameters:
key - the corner.
Returns:
the Component at the specified corner, or null if key is not one of the four valid corners.

getHorizontalScrollBar

public JScrollBar getHorizontalScrollBar()

getHorizontalScrollBarPolicy

public int getHorizontalScrollBarPolicy()

getRowHeader

public JViewport getRowHeader()

getVerticalScrollBar

public JScrollBar getVerticalScrollBar()

getVerticalScrollBarPolicy

public int getVerticalScrollBarPolicy()

getViewport

public JViewport getViewport()

getViewportBorderBounds

public Rectangle getViewportBorderBounds(JScrollPane scrollPane)

Deprecated. As of Swing 1.1 replaced by JScrollPane.getViewportBorderBounds().

Returns the bounds of the border around a ScrollPane's viewport.
Parameters:
scrollPane - the ScrollPane for which's viewport the border is requested

layoutContainer

public 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
Specified by:
layoutContainer in interface LayoutManager

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Specified by:
minimumLayoutSize in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Specified by:
preferredLayoutSize in interface LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component component)
Specified by:
removeLayoutComponent in interface LayoutManager

setHorizontalScrollBarPolicy

public void setHorizontalScrollBarPolicy(int policy)
Sets the horizontal scrollbar policy.
Parameters:
policy - must be one of HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_ALWAYS.
Throws:
IllegalArgumentException - if policy is not one of the valid JScrollbar policies.

setVerticalScrollBarPolicy

public void setVerticalScrollBarPolicy(int policy)
Sets the vertical scrollbar policy.
Parameters:
policy - must be one of VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_ALWAYS.
Throws:
IllegalArgumentException - if policy is not one of the valid JScrollBar policies.

syncWithScrollPane

public void syncWithScrollPane(JScrollPane scrollPane)

ScrollPaneLayout.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.