-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJDemoBorderLayout.java
More file actions
29 lines (26 loc) · 849 Bytes
/
Copy pathJDemoBorderLayout.java
File metadata and controls
29 lines (26 loc) · 849 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
import javax.swing.*;
import java.awt.*;
public class JDemoBorderLayout extends JFrame
{
private JButton nb = new JButton("North Button");
private JButton sb = new JButton("South Button");
private JButton eb = new JButton("East Button");
private JButton wb = new JButton("West Button");
private JButton cb = new JButton("Center Button");
private Container con = getContentPane();
public JDemoBorderLayout()
{
con.setLayout(new BorderLayout());
con.add(nb, BorderLayout.NORTH);
con.add(sb, BorderLayout.SOUTH);
con.add(eb, BorderLayout.EAST);
con.add(wb, BorderLayout.WEST);
con.add(cb, BorderLayout.CENTER);
setSize(400, 150);
}
public static void main(String[] args)
{
JDemoBorderLayout frame = new JDemoBorderLayout();
frame.setVisible(true);
}
}