-
- All Superinterfaces:
- LayoutManager
- All Known Implementing Classes:
- BasicSplitPaneUI.BasicHorizontalLayoutManager, BasicSplitPaneUI.BasicVerticalLayoutManager, BorderLayout, BoxLayout, CardLayout, DefaultMenuLayout, GridBagLayout, GroupLayout, JRootPane.RootLayout, OverlayLayout, SpringLayout
public interface LayoutManager2 extends LayoutManager
Defines an interface for classes that know how to layout Containers based on a layout constraints object. This interface extends the LayoutManager interface to deal with layouts explicitly in terms of constraint objects that specify how and where components should be added to the layout.This minimal extension to LayoutManager is intended for tool providers who wish to the creation of constraint-based layouts. It does not yet provide full, general support for custom constraint-based layout managers.
- See Also:
LayoutManager
,Container
-
-
Method Summary
Methods Modifier and Type Method and Description void
addLayoutComponent(Component comp, Object constraints)
Adds the specified component to the layout, using the specified constraint object.float
getLayoutAlignmentX(Container target)
Returns the alignment along the x axis.float
getLayoutAlignmentY(Container target)
Returns the alignment along the y axis.void
invalidateLayout(Container target)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.Dimension
maximumLayoutSize(Container target)
Calculates the maximum size dimensions for the specified container, given the components it contains.-
Methods inherited from interface java.awt.LayoutManager
addLayoutComponent, layoutContainer, minimumLayoutSize, preferredLayoutSize, removeLayoutComponent
-
-
-
-
Method Detail
-
addLayoutComponent
void addLayoutComponent(Component comp, Object constraints)
Adds the specified component to the layout, using the specified constraint object.- Parameters:
comp
- the component to be addedconstraints
- where/how the component is added to the layout.
-
maximumLayoutSize
Dimension maximumLayoutSize(Container target)
Calculates the maximum size dimensions for the specified container, given the components it contains.- See Also:
Component.getMaximumSize()
,LayoutManager
-
getLayoutAlignmentX
float getLayoutAlignmentX(Container target)
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
-
getLayoutAlignmentY
float getLayoutAlignmentY(Container target)
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
-
invalidateLayout
void invalidateLayout(Container target)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-java/awt/layoutmanager2.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.