COMP2396
Loading...
Searching...
No Matches
BorderLayoutEx.java
Go to the documentation of this file.
1
import
javax.swing.*;
2
import
java.awt.*;
3
4
public
class
BorderLayoutEx
{
5
public
static
void
main
(String[] args) {
6
BorderLayoutEx
gui =
new
BorderLayoutEx
();
7
gui.
go
();
8
}
9
10
public
void
go
() {
11
JFrame frame =
new
JFrame();
12
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
13
JButton button =
new
JButton(
"click me"
);
14
// JButton button = new JButton("click me you mean it");
15
frame.add(button, BorderLayout.EAST);
16
frame.setSize(200, 200);
17
frame.setVisible(
true
);
18
}
19
20
/* public void go() {
21
JFrame frame = new JFrame();
22
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
23
JButton button = new JButton("There is no spoon.");
24
frame.add(button, BorderLayout.NORTH);
25
frame.setSize(200, 200);
26
frame.setVisible(true);
27
} */
28
29
/* public void go() {
30
JFrame frame = new JFrame();
31
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
32
JButton button = new JButton("Click this!");
33
Font bigFont = new Font("serif", Font.BOLD, 28);
34
button.setFont(bigFont);
35
frame.add(button, BorderLayout.NORTH);
36
frame.setSize(200, 200);
37
frame.setVisible(true);
38
} */
39
40
/* public void go() {
41
JFrame frame = new JFrame();
42
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
43
JButton east = new JButton("East");
44
JButton west = new JButton("West");
45
JButton north = new JButton("North");
46
JButton south = new JButton("South");
47
JButton center = new JButton("Center");
48
frame.add(east, BorderLayout.EAST);
49
frame.add(west, BorderLayout.WEST);
50
frame.add(north, BorderLayout.NORTH);
51
frame.add(south, BorderLayout.SOUTH);
52
frame.add(center, BorderLayout.CENTER);
53
frame.setSize(300, 300);
54
frame.setVisible(true);
55
} */
56
57
}
BorderLayoutEx
Definition
BorderLayoutEx.java:4
BorderLayoutEx.main
static void main(String[] args)
Definition
BorderLayoutEx.java:5
BorderLayoutEx.go
void go()
Definition
BorderLayoutEx.java:10
chapter8
BorderLayoutEx.java
Generated on Sat Dec 7 2024 17:10:09 for COMP2396 by
1.12.0