- java.lang.Object
-
- javax.swing.OverlayLayout
-
- All Implemented Interfaces:
-
LayoutManager,LayoutManager2,Serializable
public class OverlayLayout extends Object implements LayoutManager2, Serializable
布局管理器将组件排列在彼此的顶部。 容器的要求尺寸将是所要求的最大尺寸的孩子,考虑到对齐需求。 对齐是基于正确配合孩子在分配区域所需要的。 孩子将被放置,使他们的对齐点都在彼此之上。警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,支持所有JavaBeans的长期存储已被添加到
java.beans包中。 请参阅XMLEncoder。- 从以下版本开始:
- 1.2
- 另请参见:
- Serialized Form
-
-
构造方法摘要
构造方法 Constructor 描述 OverlayLayout(Container target)构建一个布局管理器,执行子项的覆盖排列。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidaddLayoutComponent(Component comp, Object constraints)使用指定的约束对象将指定的组件添加到布局。voidaddLayoutComponent(String name, Component comp)将指定的组件添加到布局。floatgetLayoutAlignmentX(Container target)返回容器沿x轴的对齐方式。floatgetLayoutAlignmentY(Container target)返回容器沿y轴的对齐方式。ContainergetTarget()返回使用此布局管理器的容器。voidinvalidateLayout(Container target)表示小孩已更改其布局相关信息,这会导致任何缓存计算被刷新。voidlayoutContainer(Container target)当指定的容器需要布置时,由AWT调用。DimensionmaximumLayoutSize(Container target)返回布局包含在指定目标容器中的组件所需的最大尺寸。DimensionminimumLayoutSize(Container target)返回布局包含在指定目标容器中的组件所需的最小尺寸。DimensionpreferredLayoutSize(Container target)给定指定目标容器中的组件,返回此布局的首选尺寸。voidremoveLayoutComponent(Component comp)从布局中删除指定的组件。
-
-
-
构造方法详细信息
-
OverlayLayout
@ConstructorProperties("target") public OverlayLayout(Container target)
构建一个布局管理器,执行子项的覆盖排列。 创建的布局管理器专用于给定的容器。- 参数
-
target- 容器做布局反对
-
-
方法详细信息
-
getTarget
public final Container getTarget()
返回使用此布局管理器的容器。- 结果
- 使用此布局管理器的容器
- 从以下版本开始:
- 1.6
-
invalidateLayout
public void invalidateLayout(Container target)
表示小孩已更改其布局相关信息,这会导致任何缓存计算被刷新。- Specified by:
-
invalidateLayout在接口LayoutManager2 - 参数
-
target- 容器
-
addLayoutComponent
public void addLayoutComponent(String name, Component comp)
将指定的组件添加到布局。 该类用于知道何时使布局无效。- Specified by:
-
addLayoutComponent在接口LayoutManager - 参数
-
name- 组件的名称 -
comp- 要添加的组件
-
removeLayoutComponent
public void removeLayoutComponent(Component comp)
从布局中删除指定的组件。 该类用于知道何时使布局无效。- Specified by:
-
removeLayoutComponent在接口LayoutManager - 参数
-
comp- 要删除的组件
-
addLayoutComponent
public void addLayoutComponent(Component comp, Object constraints)
使用指定的约束对象将指定的组件添加到布局。 该类用于知道何时使布局无效。- Specified by:
-
addLayoutComponent在接口LayoutManager2 - 参数
-
comp- 要添加的组件 -
constraints- 组件在哪里/如何添加到布局。
-
preferredLayoutSize
public Dimension preferredLayoutSize(Container target)
给定指定目标容器中的组件,返回此布局的首选尺寸。 如果布局已被无效,则重新计算。 getInsets()返回的当前插入设置中的因素。- Specified by:
-
preferredLayoutSize在接口LayoutManager - 参数
-
target- 需要布局的组件 - 结果
- 包含优选尺寸的Dimension对象
- 另请参见:
-
minimumLayoutSize(java.awt.Container)
-
minimumLayoutSize
public Dimension minimumLayoutSize(Container target)
返回布局包含在指定目标容器中的组件所需的最小尺寸。 如果布局已被无效,则重新计算布局,以及当前插页设置中的因素。- Specified by:
-
minimumLayoutSize在接口LayoutManager - 参数
-
target- 需要布局的组件 - 结果
- 包含最小尺寸的Dimension对象
- 另请参见:
-
preferredLayoutSize(java.awt.Container)
-
maximumLayoutSize
public Dimension maximumLayoutSize(Container target)
返回布局包含在指定目标容器中的组件所需的最大尺寸。 重新计算布局,如果它已经无效,并且插入设置中的因素由getInset返回。- Specified by:
-
maximumLayoutSize在接口LayoutManager2 - 参数
-
target- 需要布局的组件 - 结果
-
一个包含最大尺寸的
Dimension对象 - 另请参见:
-
preferredLayoutSize(java.awt.Container)
-
getLayoutAlignmentX
public float getLayoutAlignmentX(Container target)
返回容器沿x轴的对齐方式。- Specified by:
-
getLayoutAlignmentX在接口LayoutManager2 - 参数
-
target- 容器 - 结果
- alignment> = 0.0f && <= 1.0f
-
getLayoutAlignmentY
public float getLayoutAlignmentY(Container target)
返回容器沿y轴的对齐方式。- Specified by:
-
getLayoutAlignmentY在接口LayoutManager2 - 参数
-
target- 容器 - 结果
- alignment> = 0.0f && <= 1.0f
-
layoutContainer
public void layoutContainer(Container target)
当指定的容器需要布置时,由AWT调用。- Specified by:
-
layoutContainer在接口LayoutManager - 参数
-
target- 要布置的容器 - 异常
-
AWTError- 如果目标不是指定给构造函数的容器
-
-