-
- All Superinterfaces:
-
LayoutManager
- 所有已知实现类:
-
BasicSplitPaneUI.BasicHorizontalLayoutManager,BasicSplitPaneUI.BasicVerticalLayoutManager,BorderLayout,BoxLayout,CardLayout,DefaultMenuLayout,GridBagLayout,GroupLayout,JRootPane.RootLayout,OverlayLayout,SpringLayout
public interface LayoutManager2 extends LayoutManager
为知道如何根据布局约束对象布局容器的类定义接口。 该接口扩展了LayoutManager接口,以便在约束对象方面明确处理布局,这些约束对象指定了如何以及组件应该添加到布局中。对LayoutManager的这种最小的扩展适用于希望创建基于约束的布局的工具提供者。 它还没有为基于约束的自定义布局管理器提供全面的一般支持。
- 另请参见:
-
LayoutManager,Container
-
-
方法摘要
所有方法 接口方法 抽象方法 Modifier and Type 方法 描述 voidaddLayoutComponent(Component comp, Object constraints)使用指定的约束对象将指定的组件添加到布局。floatgetLayoutAlignmentX(Container target)返回沿x轴的对齐方式。floatgetLayoutAlignmentY(Container target)返回沿着y轴的对齐。voidinvalidateLayout(Container target)使布局无效,指示如果布局管理器已缓存信息,则应将其丢弃。DimensionmaximumLayoutSize(Container target)给定指定容器的最大尺寸尺寸,给定其包含的组件。-
Methods inherited from interface java.awt.LayoutManager
addLayoutComponent, layoutContainer, minimumLayoutSize, preferredLayoutSize, removeLayoutComponent
-
-
-
-
方法详细信息
-
addLayoutComponent
void addLayoutComponent(Component comp, Object constraints)
使用指定的约束对象将指定的组件添加到布局。- 参数
-
comp- 要添加的组件 -
constraints- 组件如何添加到布局中。
-
maximumLayoutSize
Dimension maximumLayoutSize(Container target)
给定指定容器的最大尺寸尺寸,给定其包含的组件。- 参数
-
target- 目标容器 - 结果
- 容器的最大尺寸
- 另请参见:
-
Component.getMaximumSize(),LayoutManager
-
getLayoutAlignmentX
float getLayoutAlignmentX(Container target)
返回沿x轴的对齐方式。 这指定了组件如何相对于其他组件进行对齐。 该值应为0到1之间的数字,其中0表示原点对齐,1对齐最远离原点,0.5为中心等。- 参数
-
target- 目标容器 - 结果
- x轴对齐偏好
-
getLayoutAlignmentY
float getLayoutAlignmentY(Container target)
返回沿着y轴的对齐。 这指定了组件如何相对于其他组件进行对齐。 该值应为0到1之间的数字,其中0表示原点对齐,1对齐最远离原点,0.5为中心等。- 参数
-
target- 目标容器 - 结果
- y轴对齐偏好
-
invalidateLayout
void invalidateLayout(Container target)
使布局无效,指示如果布局管理器已缓存信息,则应将其丢弃。- 参数
-
target- 目标容器
-
-