📄 gridbaglayouttest.java~2~
字号:
package chapter7.layout;
import java.awt.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JButton;
public class GridBagLayoutTest
extends Frame
{
public GridBagLayoutTest()
{
try
{
jbInit();
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
private void jbInit()
throws Exception
{
this.setLayout(gridBagLayout1);
jButton1.setText("jButton1");
jButton2.setText("jButton2");
jButton3.setText("jButton3");
jButton4.setText("jButton4");
jButton5.setText("jButton5");
jButton6.setText("jButton6");
jButton7.setText("jButton7");
this.add(jButton1, new GridBagConstraints(0, 0, 4, 1, 0.0, 0.0
, GridBagConstraints.CENTER,
GridBagConstraints.NONE,
new Insets(48, 58, 0, 57),
211, 0));
this.add(jButton3, new GridBagConstraints(0, 1, 1, 3, 0.0, 0.0
, GridBagConstraints.CENTER,
GridBagConstraints.NONE,
new Insets(0, 58, 117, 0), 0,
78));
this.add(jButton4, new GridBagConstraints(2, 1, 2, 1, 0.0, 0.0
, GridBagConstraints.CENTER,
GridBagConstraints.NONE,
new Insets(11, 13, 0, 57), 47,
0));
this.add(jButton5, new GridBagConstraints(1, 3, 2, 1, 0.0, 0.0
, GridBagConstraints.CENTER,
GridBagConstraints.NONE,
new Insets(9, 0, 117, 0), 58,
0));
this.add(jButton2, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.CENTER,
GridBagConstraints.NONE,
new Insets(10, 0, 0, 0), 0, 0));
this.add(jButton7, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0
, GridBagConstraints.CENTER,
GridBagConstraints.NONE,
new Insets(7, 0, 117, 57), 0,
0));
this.add(jButton6, new GridBagConstraints(1, 2, 3, 1, 0.0, 0.0
, GridBagConstraints.CENTER,
GridBagConstraints.NONE,
new Insets(6, 0, 0, 57), 156,
3));
}
public static void main(String[] args)
{
GridBagLayoutTest gridbaglayouttest = new GridBagLayoutTest();
gridbaglayouttest.setSize(300,300);
gridbaglayouttest.show();
}
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
JButton jButton7 = new JButton();
GridBagLayout gridBagLayout1 = new GridBagLayout();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -