APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing

public Class ViewportLayout

extends Object
implements LayoutManager, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.awt.LayoutManager
Annotations
@SuppressWarnings:serial
Imports
java.awt.AWTError, .LayoutManager, .Component, .Container, .Rectangle, .Point, .Dimension, .Insets, java.io.Serializable

The default layout manager for JViewport. ViewportLayout defines a policy for layout that should be useful for most applications. The viewport makes its view the same size as the viewport, however it will not make the view smaller than its minimum size. As the viewport grows the view is kept bottom justified until the entire view is visible, subsequently the view is kept top justified.

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.beans.XMLEncoder.

Author
Hans Muller
Since
1.2

Field Summary

Modifier and TypeField and Description
pack-priv static ViewportLayout

Constructor Summary

AccessConstructor and Description
public
ViewportLayout()

Constructs a ViewportLayout.

Method Summary

Modifier and TypeMethod and Description
public void
addLayoutComponent(String
the name of the component
name
,
Component
the component to be added
c
)

Implements java.awt.LayoutManager.addLayoutComponent.

Adds the specified component to the layout.

public void
layoutContainer(Container
the container to lay out
parent
)

Implements java.awt.LayoutManager.layoutContainer.

Called by the AWT when the specified container needs to be laid out.

public Dimension

Returns:

a Dimension object containing the minimum dimensions
minimumLayoutSize
(Container
the component which needs to be laid out
parent
)

Implements java.awt.LayoutManager.minimumLayoutSize.

Returns the minimum dimensions needed to layout the components contained in the specified target container.

public Dimension

Returns:

a Dimension object containing the preferred dimensions
preferredLayoutSize
(Container
the component which needs to be laid out
parent
)

Implements java.awt.LayoutManager.preferredLayoutSize.

Returns the preferred dimensions for this layout given the components in the specified target container.

public void
removeLayoutComponent(Component
the component to remove
c
)

Implements java.awt.LayoutManager.removeLayoutComponent.

Removes the specified component from the layout.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

SHARED_INSTANCEback to summary
pack-priv static ViewportLayout SHARED_INSTANCE

Constructor Detail

ViewportLayoutback to summary
public ViewportLayout()

Constructs a ViewportLayout.

Method Detail

addLayoutComponentback to summary
public void addLayoutComponent(String name, Component c)

Implements java.awt.LayoutManager.addLayoutComponent.

Adds the specified component to the layout. Not used by this class.

Parameters
name:String

the name of the component

c:Component

the component to be added

layoutContainerback to summary
public void layoutContainer(Container parent)

Implements java.awt.LayoutManager.layoutContainer.

Called by the AWT when the specified container needs to be laid out.

Parameters
parent:Container

the container to lay out

Exceptions
AWTError:
if the target isn't the container specified to the BoxLayout constructor
minimumLayoutSizeback to summary
public Dimension minimumLayoutSize(Container parent)

Implements java.awt.LayoutManager.minimumLayoutSize.

Returns the minimum dimensions needed to layout the components contained in the specified target container.

Parameters
parent:Container

the component which needs to be laid out

Returns:Dimension

a Dimension object containing the minimum dimensions

See Also
preferredLayoutSize
preferredLayoutSizeback to summary
public Dimension preferredLayoutSize(Container parent)

Implements java.awt.LayoutManager.preferredLayoutSize.

Returns the preferred dimensions for this layout given the components in the specified target container.

Parameters
parent:Container

the component which needs to be laid out

Returns:Dimension

a Dimension object containing the preferred dimensions

See Also
minimumLayoutSize
removeLayoutComponentback to summary
public void removeLayoutComponent(Component c)

Implements java.awt.LayoutManager.removeLayoutComponent.

Removes the specified component from the layout. Not used by this class.

Parameters
c:Component

the component to remove