Interface LayoutManager2
- All Superinterfaces:
LayoutManager
- All Known Implementing Classes:
BasicSplitPaneUI.BasicHorizontalLayoutManager, BasicSplitPaneUI.BasicVerticalLayoutManager, BorderLayout, BoxLayout, CardLayout, DefaultMenuLayout, GridBagLayout, GroupLayout, JRootPane.RootLayout, OverlayLayout, SpringLayout
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 create constraint-based layouts.
It does not yet provide full, general support for custom
constraint-based layout managers.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddLayoutComponent(Component comp, Object constraints) Adds the specified component to the layout, using the specified constraint object.floatgetLayoutAlignmentX(Container target) Returns the alignment along the x axis.floatgetLayoutAlignmentY(Container target) Returns the alignment along the y axis.voidinvalidateLayout(Container target) Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.maximumLayoutSize(Container target) Calculates the maximum size dimensions for the specified container, given the components it contains.Methods declared in interface LayoutManager
addLayoutComponent, layoutContainer, minimumLayoutSize, preferredLayoutSize, removeLayoutComponentModifier and TypeMethodDescriptionvoidaddLayoutComponent(String name, Component comp) If the layout manager uses a per-component string, adds the componentcompto the layout, associating it with the string specified byname.voidlayoutContainer(Container parent) Lays out the specified container.minimumLayoutSize(Container parent) Calculates the minimum size dimensions for the specified container, given the components it contains.preferredLayoutSize(Container parent) Calculates the preferred size dimensions for the specified container, given the components it contains.voidRemoves the specified component from the layout.
-
Method Details
-
addLayoutComponent
-
maximumLayoutSize
-
getLayoutAlignmentX
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.- Parameters:
target- the target container- Returns:
- the x-axis alignment preference
-
getLayoutAlignmentY
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.- Parameters:
target- the target container- Returns:
- the y-axis alignment preference
-
invalidateLayout
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.- Parameters:
target- the target container
-