gridlayoutdemo.java
来自「精通JBuilder2006 源代码 精通JBuilder2006 源代码」· Java 代码 · 共 27 行
JAVA
27 行
package chapter6.layout;
import java.awt.*;
import javax.swing.*;
public class GridLayoutDemo extends JFrame {
public GridLayoutDemo() {
Container contentPane = this.getContentPane();
contentPane.setLayout(new GridLayout(2, 3, 5, 10));
contentPane.add(new JButton("one"));
contentPane.add(new JButton("two"));
contentPane.add(new JButton("three"));
contentPane.add(new JButton("four"));
contentPane.add(new JButton("five"));
contentPane.add(new JButton("six"));
this.setTitle("GridLayoutDemo");
this.setSize(400, 100);
this.setLocation(400, 400);
this.setVisible(true);
}
public static void main(String[] args) {
GridLayoutDemo test = new GridLayoutDemo();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?