-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlowLayout_t.java
More file actions
55 lines (41 loc) · 1.09 KB
/
FlowLayout_t.java
File metadata and controls
55 lines (41 loc) · 1.09 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.bj;
import java.awt.*;
import javax.swing.*;
public class FlowLayout_t extends JFrame {
JButton jb1,jb2,jb3,jb4,jb5,jb6,jb7;
public FlowLayout_t() {
//创建组件
jb1=new JButton("张三");
jb2=new JButton("李四");
jb3=new JButton("王五");
jb4=new JButton("孙六");
jb5=new JButton("周七");
jb6=new JButton("郭八");
jb7=new JButton("刘九");
//添加组件
this.add(jb1);
this.add(jb2);
this.add(jb3);
this.add(jb4);
this.add(jb5);
this.add(jb6);
this.add(jb7);
//设置布局管理器
//this.setLayout(new FlowLayout());
//this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setLayout(new FlowLayout(FlowLayout.LEFT));
//设置固定窗口
this.setResizable(false);
//设置窗体属性
this.setTitle("浮动布局案例");
this.setSize(300, 300);
this.setLocation(200,200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//显示
this.setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
FlowLayout_t f=new FlowLayout_t();
}
}