APIdia Launch Partner
Top Description Methods
java.awt

public Interface LayoutManager2

extends LayoutManager
Known Direct Implementers
javax.swing.BoxLayout, javax.swing.GroupLayout, javax.swing.JRootPane.RootLayout, javax.swing.JToolBar.DefaultToolBarLayout, javax.swing.OverlayLayout, javax.swing.SpringLayout, javax.swing.plaf.basic.BasicSplitPaneUI.BasicHorizontalLayoutManager, javax.swing.plaf.basic.BasicTextUI.UpdateHandler, javax.swing.plaf.metal.MetalRootPaneUI.MetalRootLayout, java.awt.BorderLayout, java.awt.CardLayout, java.awt.GridBagLayout

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.

Author
Jonni Kanerva
See Also
LayoutManager, Container

Method Summary

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

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

public float

Returns:

the x-axis alignment preference
getLayoutAlignmentX
(Container
the target container
target
)

Returns the alignment along the x axis.

public float

Returns:

the y-axis alignment preference
getLayoutAlignmentY
(Container
the target container
target
)

Returns the alignment along the y axis.

public void
invalidateLayout(Container
the target container
target
)

Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

public Dimension

Returns:

the maximum size of the container
maximumLayoutSize
(Container
the target container
target
)

Calculates the maximum size dimensions for the specified container, given the components it contains.

Inherited from java.awt.LayoutManager:
addLayoutComponentlayoutContainerminimumLayoutSizepreferredLayoutSizeremoveLayoutComponent

Method Detail

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

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

Parameters
comp:Component

the component to be added

constraints:Object

where/how the component is added to the layout.

getLayoutAlignmentXback to summary
public 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.

Parameters
target:Container

the target container

Returns:float

the x-axis alignment preference

getLayoutAlignmentYback to summary
public 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.

Parameters
target:Container

the target container

Returns:float

the y-axis alignment preference

invalidateLayoutback to summary
public void invalidateLayout(Container target)

Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

Parameters
target:Container

the target container

maximumLayoutSizeback to summary
public Dimension maximumLayoutSize(Container target)

Calculates the maximum size dimensions for the specified container, given the components it contains.

Parameters
target:Container

the target container

Returns:Dimension

the maximum size of the container

See Also
java.awt.Component#getMaximumSize, LayoutManager