Java Swing 探索(一)LayoutManager
?
来源:http://blog.csdn.net/chelkim/archive/2009/01/28/3854043.aspx
FlowLayout
GridLayout
GridBagLayout
CardLayout
BoxLayout
java.lang.Object
--java.awt.BorderLayout
将版面划分成东、西、南、北、中五个区域,将添加的组件按指定位置放置。
构造函数:
BorderLayout()
建立组件间无间距的BorderLayout
BorderLayout(int hgap,int vgap)
建立组件间水平间距为hgap,垂直间距为vgap的BorderLayout
例一:
?
在上例代码的第13,14行之间插入以下代码
?
java.lang.Object
--java.awt.FlowLayout
组件按从左到右而后从上到下的顺序依次排列,一行不能放完则折到下一行。
?
构造函数:
FlowLayout()
建立一个默认为居中对齐,组件彼此有5单位的水平与垂直间距的FlowLayout
FlowLayout(int align)
建立一个可设置排列方式且组件彼此有5单位的水平与垂直间距的FlowLayout
FlowLayout(int align,int hgap,int vgap)
建立一个可设置排列方式与组件间距的FlowLayout
例二:
?
view plaintext-decoration: none; color: #a0a0a0; background-image: none; background-color: inherit; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border