
 |
Chapter 19 java.awt Reference |
 |
LayoutManager2 
Name
LayoutManager2
LayoutManager2
is an extension of LayoutManager.
It provides a more generalized way to add components to a container, as
well as more sizing and alignment methods.
public abstract interface java.awt.LayoutManager2
extends java.awt.LayoutManager {
// Interface Methods
public abstract void addLayoutComponent (Component comp,
Object constraints);
public abstract float getLayoutAlignmentX(Container target);
public abstract float getLayoutAlignmentY(Container target);
public abstract void invalidateLayout(Container target);
public abstract Dimension maximumLayoutSize(Container target);
}
- Parameters
-
- comp
-
Component to add.
- constraints
-
Constraints on
the component.
- Description
-
Called to add an object to a container. This is slightly more generic than
LayoutManager's addLayoutComponent(String,
Component).
- Parameters
-
- target
-
The container to inspect.
- Returns
-
A value between 0 and 1.
- Description
-
This method returns the preferred alignment of the given container target.
A return value of 0 is left aligned, .5 is centered, and 1 is right aligned.
- Parameters
-
- target
-
The container to inspect.
- Returns
-
A value between 0 and 1.
- Description
-
This method returns the preferred alignment of the given container target.
A return value of 0 is top aligned, .5 is centered, and 1 is bottom aligned.
- Parameters
-
- target
-
The container to invalidate.
- Description
-
Sophisticated layout managers may cache information to improve performance.
This method can be used to signal the manager to discard any cached information
and start fresh.
- Returns
-
The maximum size of target.
- Parameters
-
- target
-
The container to inspect.
- Description
-
This method returns the maximum size of target
using this layout manager.
BorderLayout, CardLayout,
Component, Container,
GridBagLayout, Object,
String
|
|