//file: Boxer.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Boxer extends JPanel {
public static void main(String[] args) {
JFrame f = new JFrame("Boxer");
f.addWindowListener(new WindowAdapter( ) {
public void windowClosing(WindowEvent e) { System.exit(0); }
});
f.setSize(250, 250);
f.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( ));
f.getContentPane( ).add(box, BorderLayout.CENTER);
f.pack( );
f.setVisible(true);
}
}
|