/*
 * Swing version.
 */

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class BorderWindow extends JFrame {
    boolean inAnApplet = true;
     
    public BorderWindow() {
	super();

	JPanel contentPane = new JPanel();

        contentPane.setLayout(new BorderLayout());
        contentPane.setFont(new Font("SansSerif", Font.PLAIN, 14));
   
        contentPane.add("North", new JButton("North"));
        contentPane.add("South", new JButton("South"));
        contentPane.add("East", new JButton("East"));
        contentPane.add("West", new JButton("West"));
        contentPane.add("Center", new JButton("Center"));

	setContentPane(contentPane);

        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                if (inAnApplet) {
                    dispose();
                } else {
                    System.exit(0);
                }
            }
        });
    }

    public static void main(String args[]) {
        BorderWindow window = new BorderWindow();
        window.inAnApplet = false;

        window.setTitle("BorderWindow Application");
        window.pack();
        window.setVisible(true);
    }
}
