- java.lang.Object
-
- javax.swing.plaf.basic.BasicSplitPaneUI.BasicHorizontalLayoutManager
-
- All Implemented Interfaces:
-
LayoutManager,LayoutManager2
- Enclosing class:
- BasicSplitPaneUI
public class BasicSplitPaneUI.BasicHorizontalLayoutManager extends Object implements LayoutManager2
具有方向为HORIZONTAL_SPLIT的JSplitPanes的LayoutManager。
-
-
Field Summary
Fields Modifier and Type Field 描述 protected Component[]components组件。protected int[]sizes组件的大小。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidaddLayoutComponent(Component comp, Object constraints)使用指定的约束对象将指定的组件添加到布局。voidaddLayoutComponent(String place, Component component)将组件添加到位置。protected intgetAvailableSize(Dimension containerSize, Insets insets)根据容器大小和Insets返回可用的宽度。protected intgetInitialLocation(Insets insets)返回左边的插入,除非Insets为null,在这种情况下返回0。floatgetLayoutAlignmentX(Container target)返回沿x轴的对齐方式。floatgetLayoutAlignmentY(Container target)返回沿着y轴的对齐。protected intgetPreferredSizeOfComponent(Component c)返回传递的组件首选大小的宽度。protected intgetSizeOfComponent(Component c)返回传入组件的宽度。protected int[]getSizes()返回组件的大小。voidinvalidateLayout(Container c)什么也没做。voidlayoutContainer(Container container)实际布局。DimensionmaximumLayoutSize(Container target)返回两个方向的最大布局大小,即Integer.MAX_VALUE。DimensionminimumLayoutSize(Container container)返回包含子项所需的最小大小。DimensionpreferredLayoutSize(Container container)返回包含子项所需的首选大小。voidremoveLayoutComponent(Component component)从我们的知识中删除指定的组件。protected voidresetSizeAt(int index)在传入的位置重置组件的大小。voidresetToPreferredSizes()标记接收器,以便下次此实例布局时,它会要求首选的大小。protected voidsetComponentToSize(Component c, int size, int location, Insets insets, Dimension containerSize)将组件c的宽度设置为size,将其x位置设置为location,将y设置为insets.top并将高度设置为containerSize.height减少顶部和底部插入。protected voidsetSizes(int[] newSizes)将大小设置为newSizes。protected voidupdateComponents()确定组件。
-
-
-
字段详细信息
-
sizes
protected int[] sizes
组件的大小。
-
components
protected Component[] components
组件。
-
-
方法详细信息
-
layoutContainer
public void layoutContainer(Container container)
实际布局。- Specified by:
-
layoutContainer接口LayoutManager - 参数
-
container- 要布置的容器
-
addLayoutComponent
public void addLayoutComponent(String place, Component component)
将组件添加到位置。 Place必须是JSplitPane.LEFT,RIGHT,TOP,BOTTOM或null(对于分隔符)之一。- Specified by:
-
addLayoutComponent在接口LayoutManager - 参数
-
place- 要与组件关联的字符串 -
component- 要添加的组件
-
minimumLayoutSize
public Dimension minimumLayoutSize(Container container)
返回包含子项所需的最小大小。 宽度是所有孩子的最小宽度的总和,高度是孩子最小高度的最大值。- Specified by:
-
minimumLayoutSize在接口LayoutManager - 参数
-
container- 要布局的组件 - 结果
- 容器的最小尺寸
- 另请参见:
-
LayoutManager.preferredLayoutSize(java.awt.Container)
-
preferredLayoutSize
public Dimension preferredLayoutSize(Container container)
返回包含子项所需的首选大小。 宽度是儿童的所有优选宽度的总和,高度是儿童最大的首选高度。- Specified by:
-
preferredLayoutSize在接口LayoutManager - 参数
-
container- 要布置的容器 - 结果
- 容器的首选尺寸
- 另请参见:
-
LayoutManager.minimumLayoutSize(java.awt.Container)
-
removeLayoutComponent
public void removeLayoutComponent(Component component)
从我们的知识中删除指定的组件。- Specified by:
-
removeLayoutComponent接口LayoutManager - 参数
-
component- 要删除的组件
-
addLayoutComponent
public void addLayoutComponent(Component comp, Object constraints)
使用指定的约束对象将指定的组件添加到布局。- Specified by:
-
addLayoutComponent在接口LayoutManager2 - 参数
-
comp- 要添加的组件 -
constraints- 在哪里/如何将组件添加到布局。
-
getLayoutAlignmentX
public float getLayoutAlignmentX(Container target)
返回沿x轴的对齐方式。 这指定了组件如何相对于其他组件进行对齐。 该值应为0到1之间的数字,其中0表示原点对齐,1对齐最远离原点,0.5为中心等。- Specified by:
-
getLayoutAlignmentX在接口LayoutManager2 - 参数
-
target- 目标容器 - 结果
- x轴对齐偏好
-
getLayoutAlignmentY
public float getLayoutAlignmentY(Container target)
返回沿着y轴的对齐。 这指定了组件如何相对于其他组件进行对齐。 该值应为0到1之间的数字,其中0表示原点对齐,1对齐最远离原点,0.5为中心等。- Specified by:
-
getLayoutAlignmentY接口LayoutManager2 - 参数
-
target- 目标容器 - 结果
- y轴对齐偏好
-
invalidateLayout
public void invalidateLayout(Container c)
什么也没做。 如果开发人员真的想改变其中一个视图的大小JSplitPane.resetToPreferredSizes应该被消息。- Specified by:
-
invalidateLayout在接口LayoutManager2 - 参数
-
c- 目标容器
-
maximumLayoutSize
public Dimension maximumLayoutSize(Container target)
返回两个方向的最大布局大小,即Integer.MAX_VALUE。- Specified by:
-
maximumLayoutSize在接口LayoutManager2 - 参数
-
target- 目标容器 - 结果
- 容器的最大尺寸
- 另请参见:
-
Component.getMaximumSize(),LayoutManager
-
resetToPreferredSizes
public void resetToPreferredSizes()
标记接收器,以便下次此实例布局时,它会要求首选的大小。
-
resetSizeAt
protected void resetSizeAt(int index)
在传入的位置重置组件的大小。- 参数
-
index- 组件的索引
-
setSizes
protected void setSizes(int[] newSizes)
将大小设置为newSizes。- 参数
-
newSizes- 新尺寸
-
getSizes
protected int[] getSizes()
返回组件的大小。- 结果
- 组件的尺寸
-
getPreferredSizeOfComponent
protected int getPreferredSizeOfComponent(Component c)
返回传递的组件首选大小的宽度。- 参数
-
c- 一个组件 - 结果
- 组件的首选宽度
-
getSizeOfComponent
protected int getSizeOfComponent(Component c)
返回传入组件的宽度。- 参数
-
c- 一个组件 - 结果
- 组件的宽度
-
getAvailableSize
protected int getAvailableSize(Dimension containerSize, Insets insets)
根据容器大小和Insets返回可用宽度。- 参数
-
containerSize- 一个容器大小 -
insets- 一个插图 - 结果
- 可用宽度
-
getInitialLocation
protected int getInitialLocation(Insets insets)
返回左插图,除非Insets为null,在这种情况下返回0。- 参数
-
insets- 插图 - 结果
- 左边插图
-
setComponentToSize
protected void setComponentToSize(Component c, int size, int location, Insets insets, Dimension containerSize)
将组件c的宽度设置为size,将其x位置放置在location,y到insets.top,高度为containerSize.height减去顶部和底部的插入。- 参数
-
c- 一个组件 -
size- 一个新的宽度 -
location- 一个新的X坐标 -
insets- 一个插图 -
containerSize- 一个容器大小
-
updateComponents
protected void updateComponents()
确定组件。 每当一个新的实例安装到现有的SplitPane中时,都应该调用这个。
-
-