forked from liujiboy/Java_Course
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGridLayoutDemo.java
More file actions
32 lines (27 loc) · 772 Bytes
/
Copy pathGridLayoutDemo.java
File metadata and controls
32 lines (27 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package cqu.gui;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
public class GridLayoutDemo extends JFrame {
private static final long serialVersionUID = 2663941158824082918L;
private JButton north=new JButton("north");
private JButton south=new JButton("south");
private JButton east=new JButton("east");
private JButton west=new JButton("west");
private JButton center=new JButton("center");
public GridLayoutDemo()
{
setLayout(new GridLayout(3,2));
add(north);
add(south);
add(east);
add(west);
add(center);
}
public static void main(String[] args) {
GridLayoutDemo demo=new GridLayoutDemo();
demo.setSize(400, 400);
demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
demo.setVisible(true);
}
}