FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaGraph/MultiLayout.java at master · goder/JavaGraph · GitHub
goder
JavaGraph
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaGraph
/
MultiLayout.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
70 lines (47 loc) · 1.06 KB
Breadcrumbs
JavaGraph
/
MultiLayout.java
Copy path
File metadata and controls
70 lines (47 loc) · 1.06 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* 多组件布局
*/
package
com
.
bj
;
import
javax
.
swing
.*;
import
java
.
awt
.*;
public
class
MultiLayout
extends
JFrame
{
//定义组件
JPanel
jp1
,
jp2
;
JButton
jb1
,
jb2
,
jb3
,
jb4
,
jb5
,
jb6
;
public
static
void
main
(
String
[]
args
) {
// TODO Auto-generated method stub
MultiLayout
m
=
new
MultiLayout
();
}
public
MultiLayout
(){
//创建组件
//Jpanel布局默认是FlowLayout
jp1
=
new
JPanel
();
jp2
=
new
JPanel
();
jb1
=
new
JButton
(
"西瓜"
);
jb2
=
new
JButton
(
"苹果"
);
jb3
=
new
JButton
(
"香蕉"
);
jb4
=
new
JButton
(
"葡8萄"
);
jb5
=
new
JButton
(
"芒果"
);
jb6
=
new
JButton
(
"鸭梨"
);
//设置布局
//添加组件
jp1
.
add
(
jb1
);
jp1
.
add
(
jb2
);
jp1
.
add
(
jb3
);
jp2
.
add
(
jb4
);
jp2
.
add
(
jb5
);
//把Panel加入JFrame
this
.
add
(
jp1
,
BorderLayout
.
NORTH
);
this
.
add
(
jb6
);
this
.
add
(
jp2
,
BorderLayout
.
SOUTH
);
//设置大小
this
.
setTitle
(
"MultiLayout"
);
this
.
setSize
(
500
,
500
);
this
.
setLocation
(
200
,
200
);
//设置
//this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//this.location(200,300);
//设置可见
this
.
setVisible
(
true
);
}
}
Back
|
FazBrowse Home
|
New Git URL