forked from patniemeyer/learningjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBorder1.java
More file actions
24 lines (21 loc) · 699 Bytes
/
Copy pathBorder1.java
File metadata and controls
24 lines (21 loc) · 699 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
//file: Border1.java
import java.awt.*;
import javax.swing.*;
public class Border1 extends JPanel {
public Border1() {
setLayout(new BorderLayout( ));
add(new JButton("North"), BorderLayout.NORTH);
add(new JButton("South"), BorderLayout.SOUTH);
add(new JButton("East"), BorderLayout.EAST);
add(new JButton("West"), BorderLayout.WEST);
add(new JButton("Center"), BorderLayout.CENTER);
}
public static void main(String[] args) {
JFrame frame = new JFrame("Border1");
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize(300, 300);
frame.setLocation(200, 200);
frame.setContentPane(new Border1());
frame.setVisible(true);
}
}