APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing

public Class OverlayLayout

extends Object
implements LayoutManager2, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.awt.LayoutManager2, java.awt.LayoutManager
Annotations
@SuppressWarnings:serial
Imports
java.awt.*, java.beans.ConstructorProperties, java.io.Serializable

A layout manager to arrange components over the top of each other. The requested size of the container will be the largest requested size of the children, taking alignment needs into consideration. The alignment is based upon what is needed to properly fit the children in the allocation area. The children will be placed such that their alignment points are all on top of each other.

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
Timothy Prinzing
Since
1.2

Field Summary

Modifier and TypeField and Description
private Container
private SizeRequirements[]
private SizeRequirements
private SizeRequirements[]
private SizeRequirements

Constructor Summary

AccessConstructor and Description
public
OverlayLayout(Container
the container to do layout against
target
)

Constructs a layout manager that performs overlay arrangement of the children.

Method Summary

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

Implements java.awt.LayoutManager.addLayoutComponent.

Adds the specified component to the layout.

public void
addLayoutComponent(Component
the component to be added
comp
,
Object
where/how the component is added to the layout.
constraints
)

Implements java.awt.LayoutManager2.addLayoutComponent.

Adds the specified component to the layout, using the specified constraint object.

pack-priv void
pack-priv void
public float

Returns:

the alignment >= 0.0f && <= 1.0f
getLayoutAlignmentX
(Container
the container
target
)

Implements java.awt.LayoutManager2.getLayoutAlignmentX.

Returns the alignment along the x axis for the container.

public float

Returns:

the alignment >= 0.0f && <= 1.0f
getLayoutAlignmentY
(Container
the container
target
)

Implements java.awt.LayoutManager2.getLayoutAlignmentY.

Returns the alignment along the y axis for the container.

public final Container

Returns:

the container that uses this layout manager
getTarget
()

Returns the container that uses this layout manager.

public void
invalidateLayout(Container
the container
target
)

Implements java.awt.LayoutManager2.invalidateLayout.

Indicates a child has changed its layout related information, which causes any cached calculations to be flushed.

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

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 maximum dimensions
maximumLayoutSize
(Container
the component that needs to be laid out
target
)

Implements java.awt.LayoutManager2.maximumLayoutSize.

Returns the maximum dimensions needed to lay out the components contained in the specified target container.

public Dimension

Returns:

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

Implements java.awt.LayoutManager.minimumLayoutSize.

Returns the minimum dimensions needed to lay out 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
target
)

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
comp
)

Implements java.awt.LayoutManager.removeLayoutComponent.

Removes the specified component from the layout.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

targetback to summary
private Container target
xChildrenback to summary
private SizeRequirements[] xChildren
xTotalback to summary
private SizeRequirements xTotal
yChildrenback to summary
private SizeRequirements[] yChildren
yTotalback to summary
private SizeRequirements yTotal

Constructor Detail

OverlayLayoutback to summary
public OverlayLayout(Container target)

Constructs a layout manager that performs overlay arrangement of the children. The layout manager created is dedicated to the given container.

Parameters
target:Container

the container to do layout against

Annotations
@ConstructorProperties:target

Method Detail

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

Implements java.awt.LayoutManager.addLayoutComponent.

Adds the specified component to the layout. Used by this class to know when to invalidate layout.

Parameters
name:String

the name of the component

comp:Component

the component to be added

addLayoutComponentback to summary
public void addLayoutComponent(Component comp, Object constraints)

Implements java.awt.LayoutManager2.addLayoutComponent.

Adds the specified component to the layout, using the specified constraint object. Used by this class to know when to invalidate layout.

Parameters
comp:Component

the component to be added

constraints:Object

where/how the component is added to the layout.

checkContainerback to summary
pack-priv void checkContainer(Container target)
checkRequestsback to summary
pack-priv void checkRequests()
getLayoutAlignmentXback to summary
public float getLayoutAlignmentX(Container target)

Implements java.awt.LayoutManager2.getLayoutAlignmentX.

Returns the alignment along the x axis for the container.

Parameters
target:Container

the container

Returns:float

the alignment >= 0.0f && <= 1.0f

getLayoutAlignmentYback to summary
public float getLayoutAlignmentY(Container target)

Implements java.awt.LayoutManager2.getLayoutAlignmentY.

Returns the alignment along the y axis for the container.

Parameters
target:Container

the container

Returns:float

the alignment >= 0.0f && <= 1.0f

getTargetback to summary
public final Container getTarget()

Returns the container that uses this layout manager.

Returns:Container

the container that uses this layout manager

Since
1.6
invalidateLayoutback to summary
public void invalidateLayout(Container target)

Implements java.awt.LayoutManager2.invalidateLayout.

Indicates a child has changed its layout related information, which causes any cached calculations to be flushed.

Parameters
target:Container

the container

layoutContainerback to summary
public void layoutContainer(Container target)

Implements java.awt.LayoutManager.layoutContainer.

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

Parameters
target:Container

the container to lay out

Exceptions
AWTError:
if the target isn't the container specified to the constructor
maximumLayoutSizeback to summary
public Dimension maximumLayoutSize(Container target)

Implements java.awt.LayoutManager2.maximumLayoutSize.

Returns the maximum dimensions needed to lay out the components contained in the specified target container. Recomputes the layout if it has been invalidated, and factors in the inset setting returned by getInset.

Parameters
target:Container

the component that needs to be laid out

Returns:Dimension

a Dimension object containing the maximum dimensions

See Also
preferredLayoutSize
minimumLayoutSizeback to summary
public Dimension minimumLayoutSize(Container target)

Implements java.awt.LayoutManager.minimumLayoutSize.

Returns the minimum dimensions needed to lay out the components contained in the specified target container. Recomputes the layout if it has been invalidated, and factors in the current inset setting.

Parameters
target: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 target)

Implements java.awt.LayoutManager.preferredLayoutSize.

Returns the preferred dimensions for this layout given the components in the specified target container. Recomputes the layout if it has been invalidated. Factors in the current inset setting returned by getInsets().

Parameters
target: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 comp)

Implements java.awt.LayoutManager.removeLayoutComponent.

Removes the specified component from the layout. Used by this class to know when to invalidate layout.

Parameters
comp:Component

the component to remove