- java.lang.Object
-
- javax.swing.JRootPane.RootLayout
-
- All Implemented Interfaces:
-
LayoutManager,LayoutManager2,Serializable
- Enclosing class:
- JRootPane
protected class JRootPane.RootLayout extends Object implements LayoutManager2, Serializable
一个自定义布局管理器,负责分层面,玻璃面和菜单栏的布局。警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对于所有JavaBeans的长期存储的支持已被添加到
java.beans包中。 请参阅XMLEncoder。- 另请参见:
- Serialized Form
-
-
构造方法摘要
构造方法 Modifier Constructor 描述 protectedRootLayout()
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidaddLayoutComponent(Component comp, Object constraints)使用指定的约束对象将指定的组件添加到布局。voidaddLayoutComponent(String name, Component comp)如果布局管理器使用每个组件字符串,则将组件comp添加到布局,将其与name指定的字符串相关联。floatgetLayoutAlignmentX(Container target)返回沿x轴的对齐方式。floatgetLayoutAlignmentY(Container target)返回沿着y轴的对齐。voidinvalidateLayout(Container target)使布局无效,指示如果布局管理器已缓存信息,则应将其丢弃。voidlayoutContainer(Container parent)指示布局管理器执行指定容器的布局。DimensionmaximumLayoutSize(Container target)返回布局可以使用的最大空间量。DimensionminimumLayoutSize(Container parent)返回布局所需的最小空间量。DimensionpreferredLayoutSize(Container parent)返回布局想要的空间量。voidremoveLayoutComponent(Component comp)从布局中删除指定的组件。
-
-
-
方法详细信息
-
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
返回布局想要的空间量。- Specified by:
-
preferredLayoutSize在接口LayoutManager - 参数
-
parent- 正在使用此布局管理器的容器 - 结果
- 包含布局首选大小的Dimension对象
- 另请参见:
-
LayoutManager.minimumLayoutSize(java.awt.Container)
-
minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)
返回布局所需的最小空间量。- Specified by:
-
minimumLayoutSize在接口LayoutManager - 参数
-
parent- 正在使用此布局管理器的容器 - 结果
- 包含布局最小尺寸的Dimension对象
- 另请参见:
-
LayoutManager.preferredLayoutSize(java.awt.Container)
-
maximumLayoutSize
public Dimension maximumLayoutSize(Container target)
返回布局可以使用的最大空间量。- Specified by:
-
maximumLayoutSize在接口LayoutManager2 - 参数
-
target- 正在使用此布局管理器的容器 - 结果
- 包含布局最大尺寸的Dimension对象
- 另请参见:
-
Component.getMaximumSize(),LayoutManager
-
layoutContainer
public void layoutContainer(Container parent)
指示布局管理器执行指定容器的布局。- Specified by:
-
layoutContainer在接口LayoutManager - 参数
-
parent- 正在使用此布局管理器的容器
-
addLayoutComponent
public void addLayoutComponent(String name, Component comp)
说明从接口LayoutManager复制如果布局管理器使用每个组件字符串,则将组件comp添加到布局,将其与name指定的字符串相关联。- Specified by:
-
addLayoutComponent接口LayoutManager - 参数
-
name- 与组件关联的字符串 -
comp- 要添加的组件
-
removeLayoutComponent
public void removeLayoutComponent(Component comp)
描述从界面LayoutManager复制从布局中删除指定的组件。- Specified by:
-
removeLayoutComponent在接口LayoutManager - 参数
-
comp- 要删除的组件
-
addLayoutComponent
public void addLayoutComponent(Component comp, Object constraints)
说明从界面LayoutManager2复制使用指定的约束对象将指定的组件添加到布局。- Specified by:
-
addLayoutComponent在接口LayoutManager2 - 参数
-
comp- 要添加的组件 -
constraints- 在哪里/如何将组件添加到布局中。
-
getLayoutAlignmentX
public float getLayoutAlignmentX(Container target)
说明从接口LayoutManager2复制返回沿x轴的对齐方式。 这指定了组件如何相对于其他组件进行对齐。 该值应为0到1之间的数字,其中0表示原点对齐,1对齐最远离原点,0.5为中心等。- Specified by:
-
getLayoutAlignmentX在接口LayoutManager2 - 参数
-
target- 目标容器 - 结果
- x轴对齐偏好
-
getLayoutAlignmentY
public float getLayoutAlignmentY(Container target)
说明从接口LayoutManager2复制返回沿着y轴的对齐。 这指定了组件如何相对于其他组件进行对齐。 该值应为0到1之间的数字,其中0表示原点对齐,1对齐最远离原点,0.5为中心等。- Specified by:
-
getLayoutAlignmentY在接口LayoutManager2 - 参数
-
target- 目标容器 - 结果
- y轴对齐偏好
-
invalidateLayout
public void invalidateLayout(Container target)
描述从接口LayoutManager2复制使布局无效,指示如果布局管理器已缓存信息,则应将其丢弃。- Specified by:
-
invalidateLayout在接口LayoutManager2 - 参数
-
target- 目标容器
-
-