文件名称:GridBagEx1
- 所属分类:
- JSP源码/Java
- 资源属性:
- [Java] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
gridbaglayout example-import java.awt.*
import java.util.*
import java.applet.Applet
public class GridBagEx1 extends Applet {
protected void makebutton(String name, GridBagLayout gridbag,
GridBagConstraints c) {
Button button = new Button(name)
gridbag.setConstraints(button, c)
add(button)
}
public void init() {
GridBagLayout gridbag = new GridBagLayout()
GridBagConstraints c = new GridBagConstraints()
setFont(new Font("SansSerif", Font.PLAIN, 14))
setLayout(gridbag)
c.fill = GridBagConstraints.BOTH
c.weightx = 1.0
// makebutton("Button1", gridbag, c)
// makebutton("Button2", gridbag, c)
// makebutton("Button3", gridbag, c)
c.gridwidth = GridBagConstraints.REMAINDER // end row
makebutton("Button4", gridbag, c)
c.weightx = 0.0 // reset to the default
makebutton("Button5", gridbag, c) // another row
c.gridwidth = GridBagConstraints.RELATIVE // next-to-last in row
makebutton("Button6", gridbag, c)
c
import java.util.*
import java.applet.Applet
public class GridBagEx1 extends Applet {
protected void makebutton(String name, GridBagLayout gridbag,
GridBagConstraints c) {
Button button = new Button(name)
gridbag.setConstraints(button, c)
add(button)
}
public void init() {
GridBagLayout gridbag = new GridBagLayout()
GridBagConstraints c = new GridBagConstraints()
setFont(new Font("SansSerif", Font.PLAIN, 14))
setLayout(gridbag)
c.fill = GridBagConstraints.BOTH
c.weightx = 1.0
// makebutton("Button1", gridbag, c)
// makebutton("Button2", gridbag, c)
// makebutton("Button3", gridbag, c)
c.gridwidth = GridBagConstraints.REMAINDER // end row
makebutton("Button4", gridbag, c)
c.weightx = 0.0 // reset to the default
makebutton("Button5", gridbag, c) // another row
c.gridwidth = GridBagConstraints.RELATIVE // next-to-last in row
makebutton("Button6", gridbag, c)
c
(系统自动生成,下载前可以参看下载内容)
下载文件列表
GridBagEx1.java