📄 gridlayouttest.java~3~
字号:
package chapter7.layout;
import java.awt.*;
public class GridLayoutTest
extends Frame
{
GridLayout gridLayout1 = new GridLayout(2, 4);
Button button1 = new Button();
Button button2 = new Button();
Button button3 = new Button();
Button button4 = new Button();
Button button5 = new Button();
Button button6 = new Button();
Button button7 = new Button();
Button button8 = new Button();
public GridLayoutTest()
{
try
{
jbInit();
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
private void jbInit()
throws Exception
{
this.setLayout(gridLayout1);
button1.setLabel("button1");
button2.setLabel("button2");
button3.setLabel("button3");
button4.setLabel("button4");
button5.setLabel("button5");
button6.setLabel("button6");
button7.setLabel("button7");
button8.setLabel("button8");
this.add(button1);
this.add(button3);
this.add(button5);
this.add(button7);
this.add(button2);
this.add(button4);
this.add(button6);
this.add(button8);
}
public static void main(String[] args)
{
GridLayoutTest gridlayouttest = new GridLayoutTest();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -