public class OverlayLayout extends Object implements LayoutManager2, 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 XMLEncoder
.
@ConstructorProperties(value="target") 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.
target
- the container to do layout againstpublic final Container getTarget()
Returns the container that uses this layout manager.
public void invalidateLayout(Container target)
Indicates a child has changed its layout related information, which causes any cached calculations to be flushed.
invalidateLayout
in interface LayoutManager2
target
- the containerpublic void addLayoutComponent(String name, Component comp)
Adds the specified component to the layout. Used by this class to know when to invalidate layout.
addLayoutComponent
in interface LayoutManager
name
- the name of the componentcomp
- the the component to be addedpublic void removeLayoutComponent(Component comp)
Removes the specified component from the layout. Used by this class to know when to invalidate layout.
removeLayoutComponent
in interface LayoutManager
comp
- the component to removepublic void addLayoutComponent(Component comp, Object constraints)
Adds the specified component to the layout, using the specified constraint object. Used by this class to know when to invalidate layout.
addLayoutComponent
in interface LayoutManager2
comp
- the component to be addedconstraints
- where/how the component is added to the layout.public Dimension preferredLayoutSize(Container target)
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().
preferredLayoutSize
in interface LayoutManager
target
- the component which needs to be laid outminimumLayoutSize(java.awt.Container)
public Dimension minimumLayoutSize(Container target)
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.
minimumLayoutSize
in interface LayoutManager
target
- the component which needs to be laid outpreferredLayoutSize(java.awt.Container)
public Dimension maximumLayoutSize(Container target)
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
.
maximumLayoutSize
in interface LayoutManager2
target
- the component that needs to be laid outDimension
object containing the maximum dimensionspreferredLayoutSize(java.awt.Container)
public float getLayoutAlignmentX(Container target)
Returns the alignment along the x axis for the container.
getLayoutAlignmentX
in interface LayoutManager2
target
- the containerpublic float getLayoutAlignmentY(Container target)
Returns the alignment along the y axis for the container.
getLayoutAlignmentY
in interface LayoutManager2
target
- the containerpublic void layoutContainer(Container target)
Called by the AWT when the specified container needs to be laid out.
layoutContainer
in interface LayoutManager
target
- the container to lay outAWTError
- if the target isn't the container specified to the constructor
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.