收藏 分销(赏)

JAVA SWING 4中布局方式.doc

上传人:xrp****65 文档编号:8972897 上传时间:2025-03-09 格式:DOC 页数:11 大小:327.50KB
下载 相关 举报
JAVA SWING 4中布局方式.doc_第1页
第1页 / 共11页
JAVA SWING 4中布局方式.doc_第2页
第2页 / 共11页
点击查看更多>>
资源描述
布 局 管 理 1、流式布局 FlowLayout java.awt 类 FlowLayout java.lang.Object java.awt.FlowLayout 所有已实现的接口: LayoutManager, Serializable 字段摘要 static int CENTER           此值指示每一行组件都应该是居中的。 static int LEADING           此值指示每一行组件都应该与容器方向的开始边对齐,例如,对于从左到右的方向,则与左边对齐。 static int LEFT           此值指示每一行组件都应该是左对齐的。 static int RIGHT           此值指示每一行组件都应该是右对齐的。 static int TRAILING           此值指示每行组件都应该与容器方向的结束边对齐,例如,对于从左到右的方向,则与右边对齐。   构造方法摘要 FlowLayout()           构造一个新的 FlowLayout,它是居中对齐的,默认的水平和垂直间隙是 5 个单位。 FlowLayout(int align)           构造一个新的 FlowLayout,它具有指定的对齐方式,默认的水平和垂直间隙是 5 个单位。 FlowLayout(int align, int hgap, int vgap)           创建一个新的流布局管理器,它具有指定的对齐方式以及指定的水平和垂直间隙。   方法摘要 void addLayoutComponent(String name, Component comp)           将指定的组件添加到布局中。 int getAlignment()           获取此布局的对齐方式。 boolean getAlignOnBaseline()           如果组件将沿其基线垂直对齐,则返回 true。 int getHgap()           获取组件之间以及组件与 Container 的边之间的水平间隙。 int getVgap()           获取组件之间以及组件与 Container 的边之间的垂直间隙。 void layoutContainer(Container target)           布置该容器。 Dimension minimumLayoutSize(Container target)           返回需要布置 visible 组件的最小维数,该组件包含在指定的目标容器中。 Dimension preferredLayoutSize(Container target)           给出指定目标容器中的 visible 组件,返回此布局的首选维数。 void removeLayoutComponent(Component comp)           从布局中移除指定的组件。 void setAlignment(int align)           设置此布局的对齐方式。 void setAlignOnBaseline(boolean alignOnBaseline)           设置组件是否应该沿着其基线垂直对齐。 void setHgap(int hgap)           设置组件之间以及组件与 Container 的边之间的水平间隙。 void setVgap(int vgap)           设置组件之间以及组件与 Container 的边之间的垂直间隙。 String toString()           返回此 FlowLayout 对象及其值的字符串表示形式。   从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 2、边框布局 BorderLayout java.awt 类 BorderLayout java.lang.Object java.awt.BorderLayout 所有已实现的接口: LayoutManager, LayoutManager2, Serializable 字段摘要 static String AFTER_LAST_LINE           与 PAGE_END 同义。 static String AFTER_LINE_ENDS           与 LINE_END 同义。 static String BEFORE_FIRST_LINE           与 PAGE_START 同义。 static String BEFORE_LINE_BEGINS           与 LINE_START 同义。 static String CENTER           中间区域的布局约束(容器中央)。 static String EAST           东区域的布局约束(容器右边)。 static String LINE_END           组件出现在布局的行方向的结尾处。 static String LINE_START           组件出现在布局的行方向的开始处。 static String NORTH           北区域的布局约束(容器顶部)。 static String PAGE_END           组件出现在最后一行布局内容之后。 static String PAGE_START           组件出现在第一行布局内容之前。 static String SOUTH           南区域的布局约束(容器底部)。 static String WEST           西区域的布局约束(容器左边)。   构造方法摘要 BorderLayout()           构造一个组件之间没有间距的新边框布局。 BorderLayout(int hgap, int vgap)           构造一个具有指定组件间距的边框布局。   方法摘要 void addLayoutComponent(Component comp, Object constraints)           使用指定的约束对象将指定组件添加到布局中。 void addLayoutComponent(String name, Component comp)           已过时。 由 addLayoutComponent(Component, Object) 取代。 Object getConstraints(Component comp)           获取指定组件的约束 int getHgap()           返回组件之间的水平间距。 float getLayoutAlignmentX(Container parent)           返回沿 x 轴的对齐方式。 float getLayoutAlignmentY(Container parent)           返回沿 y 轴的对齐方式。 Component getLayoutComponent(Container target, Object constraints)           基于目标 Container 的组件方向,返回给定约束位置对应的组件。 Component getLayoutComponent(Object constraints)           获取使用给定约束添加的组件。 int getVgap()           返回组件之间的垂直间距。 void invalidateLayout(Container target)           使布局无效,指示如果布局管理器缓存了信息,则应该将其丢弃。 void layoutContainer(Container target)           使用此边框布局对容器参数进行布局。 Dimension maximumLayoutSize(Container target)           在给出指定目标容器中的组件的前提下,返回此布局的最大尺寸。 Dimension minimumLayoutSize(Container target)           使用此布局管理器确定 target 容器的最小大小。 Dimension preferredLayoutSize(Container target)           基于容器中的组件,使用此布局管理器确定 target 容器的首选大小。 void removeLayoutComponent(Component comp)           从此边框布局中移除指定组件。 void setHgap(int hgap)           设置组件之间的水平间距。 void setVgap(int vgap)           设置组件之间的垂直间距。 String toString()           返回此边框布局的状态的字符串表示形式。   从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 3、网格布局 GridLayout java.awt 类 GridLayout java.lang.Object java.awt.GridLayout 所有已实现的接口: LayoutManager, Serializable 构造方法摘要 GridLayout()           创建具有默认值的网格布局,即每个组件占据一行一列。 GridLayout(int rows, int cols)           创建具有指定行数和列数的网格布局。 GridLayout(int rows, int cols, int hgap, int vgap)           创建具有指定行数和列数的网格布局。   方法摘要 void addLayoutComponent(String name, Component comp)           将具有指定名称的指定组件添加到布局。 int getColumns()           获取此布局中的列数。 int getHgap()           获取组件之间的水平间距。 int getRows()           获取此布局中的行数。 int getVgap()           获取组件之间的垂直间距。 void layoutContainer(Container parent)           使用此布局布置指定容器。 Dimension minimumLayoutSize(Container parent)           使用此网络布局确定最小大小的容器参数。 Dimension preferredLayoutSize(Container parent)           使用此网格布局确定容器参数的首选大小。 void removeLayoutComponent(Component comp)           从布局移除指定组件。 void setColumns(int cols)           将此布局中的列数设置为指定值。 void setHgap(int hgap)           将组件之间的水平间距设置为指定值。 void setRows(int rows)           将此布局中的行数设置为指定值。 void setVgap(int vgap)           将组件之间的垂直间距设置为指定值。 String toString()           返回此网格布局的值的字符串表示形式。   从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 4、网格袋布局 GridBagLayout java.awt 类 GridBagLayout java.lang.Object java.awt.GridBagLayout 所有已实现的接口: LayoutManager, LayoutManager2, Serializable 字段摘要 double[] columnWeights           此字段保持对列权重的重写。 int[] columnWidths           此字段保持对列最小宽度的重写。 protected  Hashtable<Component,GridBagConstraints> comptable           此哈希表维持组件与其网格包约束之间的关联。 protected  GridBagConstraints defaultConstraints           此字段保持包含默认值的网格包约束实例,因此如果某个组件没有与其相关联的网格包约束,则会分配给该组件一个 defaultConstraints 的副本。 protected  GridBagLayoutInfo layoutInfo           此字段保持网格包的布局信息。 protected static int MAXGRIDSIZE           此字段不再用于保留数组和保持向后兼容性。 protected static int MINSIZE           网格包布局可以布置的最小网格。 protected static int PREFERREDSIZE           网格包布局可以布置的首选网格大小。 int[] rowHeights           此字段保持对行最小高度的重写。 double[] rowWeights           此字段保持对行权重的重写。   构造方法摘要 GridBagLayout()           创建网格包布局管理器。   方法摘要 void addLayoutComponent(Component comp, Object constraints)           使用指定 constraints 对象将指定组件添加到布局中。 void addLayoutComponent(String name, Component comp)           无效,因为此布局管理器不使用每组件字符串。 protected  void adjustForGravity(GridBagConstraints constraints, Rectangle r)           根据约束几何结构和填充将 x、y、宽度和高度四个字段调整为正确值。 protected  void AdjustForGravity(GridBagConstraints constraints, Rectangle r)           此方法已过时,仅为提供向后兼容性;新代码应该调用 adjustForGravity 来代替。 protected  void arrangeGrid(Container parent)           布置网格。 protected  void ArrangeGrid(Container parent)           此方法已过时,仅为提供向后兼容性;新代码应该调用 arrangeGrid 来代替。 GridBagConstraints getConstraints(Component comp)           获取指定组件的约束。 float getLayoutAlignmentX(Container parent)           返回沿 X 轴的对齐方式。 float getLayoutAlignmentY(Container parent)           返回沿 y 轴的对齐方式。 int[][] getLayoutDimensions()           确定布局网格的列宽度和行高度。 protected  GridBagLayoutInfo getLayoutInfo(Container parent, int sizeflag)           为当前受管子级的集合填充 GridBagLayoutInfo 的实例。 protected  GridBagLayoutInfo GetLayoutInfo(Container parent, int sizeflag)           此方法已过时,仅为提供向后兼容性;新代码应该调用 getLayoutInfo 来代替。 Point getLayoutOrigin()           在目标容器的图形坐标空间确定布局区域的原点。 double[][] getLayoutWeights()           确定布局网格的行与列的权重。 protected  Dimension getMinSize(Container parent, GridBagLayoutInfo info)           基于 getLayoutInfo 中的信息计算其所有者的最小大小。 protected  Dimension GetMinSize(Container parent, GridBagLayoutInfo info)           此方法已过时,仅为提供向后兼容性;新代码应该调用 getMinSize 来代替。 void invalidateLayout(Container target)           使布局失效,指示如果布局管理器缓存了信息,则应该将其丢弃。 void layoutContainer(Container parent)           使用此网格包布局布置指定容器。 Point location(int x, int y)           确定在布局网格中哪个单元包含由 (x, y) 指定的点。 protected  GridBagConstraints lookupConstraints(Component comp)           检索指定组件的约束。 Dimension maximumLayoutSize(Container target)           在给出指定目标容器中的组件的前提下,返回此布局的最大维数 Dimension minimumLayoutSize(Container parent)           使用此网格包布局确定 parent 容器的最小大小。 Dimension preferredLayoutSize(Container parent)           使用此网络包布局确定 parent 容器的首选大小。 void removeLayoutComponent(Component comp)           从此布局移除指定组件。 void setConstraints(Component comp, GridBagConstraints constraints)           设置此布局中指定组件的约束条件。 String toString()           返回此网格包布局的值的字符串表示形式。   从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传
相似文档                                   自信AI助手自信AI助手

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服