forked from patniemeyer/learningjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoxer.java
More file actions
27 lines (26 loc) · 888 Bytes
/
Copy pathBoxer.java
File metadata and controls
27 lines (26 loc) · 888 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
//file: Boxer.java
import java.awt.*;
import javax.swing.*;
public class Boxer extends JPanel {
public static void main(String[] args) {
JFrame frame = new JFrame("Boxer");
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize(250, 250);
frame.setLocation(200, 200);
Container box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
box.add(new JButton("In the"));
box.add(Box.createHorizontalGlue());
box.add(new JButton("clearing"));
box.add(Box.createHorizontalStrut(10));
box.add(new JButton("stands"));
box.add(Box.createHorizontalStrut(10));
box.add(new JButton("a"));
box.add(Box.createHorizontalGlue());
box.add(new JButton("boxer"));
box.add(Box.createHorizontalGlue());
frame.getContentPane().add(box, BorderLayout.CENTER);
frame.pack( );
frame.setVisible(true);
}
}