/*
 * 1.0 code.
 */

import java.awt.*;

public class CustomWindow extends Frame {
    private boolean inAnApplet = true;
     
    public CustomWindow() {
        setLayout(new DiagonalLayout());
        setFont(new Font("Helvetica", Font.PLAIN, 14));
   
        add(new Button("Button 1"));
        add(new Button("Button 2"));
        add(new Button("Button 3"));
        add(new Button("Button 4"));
        add(new Button("Button 5"));
    }

    public boolean handleEvent(Event e) {
        if (e.id == Event.WINDOW_DESTROY) {
            if (inAnApplet) {
                dispose();
                return true;
            } else {
                System.exit(0);
            }
        }   
        return super.handleEvent(e);
    }

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

        window.setTitle("CustomWindow Application");
        window.pack();
        window.show();
    }
}
