Example usage for java.awt.event WindowAdapter WindowAdapter

List of usage examples for java.awt.event WindowAdapter WindowAdapter

Introduction

In this page you can find the example usage for java.awt.event WindowAdapter WindowAdapter.

Prototype

WindowAdapter

Source Link

Usage

From source file:DashedStrokeDemo.java

public static void main(String s[]) {
    JFrame f = new JFrame();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from w  w  w  . ja va  2  s .c  o m
        }
    });
    DashedStrokeDemo p = new DashedStrokeDemo();
    f.getContentPane().add("Center", p);
    p.init();
    f.pack();
    f.setSize(new Dimension(250, 250));
    f.show();
}

From source file:JTextAreaDemo.java

public static void main(String[] args) {
    JFrame frame = new JTextAreaDemo();
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/*from   w  ww.j  a v  a 2  s .  com*/
        }
    });

    frame.pack();
    frame.setVisible(true);
}

From source file:FontPaint.java

public static void main(String[] args) {
    FontPanel starPanel = new FontPanel();

    JFrame f = new JFrame("Font");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from  www . j  a v  a  2 s .  co m
        }
    });

    f.getContentPane().add(starPanel, BorderLayout.CENTER);
    f.setSize(new Dimension(550, 200));
    f.setVisible(true);
}

From source file:HelloInJapanese.java

public static void main(String argv[]) {

    HelloInJapanese japanesePanel = new HelloInJapanese(helloInJapanese);

    frame = new JFrame("Hello in Japanese");
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/*ww w .  j  a v  a  2s. co m*/
        }
    });
    frame.getContentPane().add("Center", japanesePanel);
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] argv) {
    JFrame f = new JFrame();
    f.setSize(400, 300);// ww w . j  ava  2s.  c om
    Polygon p = new Polygon();
    p.addPoint(10, 10);
    p.addPoint(100, 300);
    p.addPoint(300, 300);
    p.addPoint(10, 10);

    PolygonButton btn = new PolygonButton(p, "button");
    f.getContentPane().add(btn);
    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    f.addWindowListener(wndCloser);
    f.setVisible(true);
}

From source file:AllAvailableFontsComboBox.java

public static void main(String s[]) {
    JFrame f = new JFrame("FontSelection");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//w  ww .  j  a v  a 2  s . c  om
        }
    });
    AllAvailableFontsComboBox fontSelection = new AllAvailableFontsComboBox();
    f.getContentPane().add(fontSelection, BorderLayout.CENTER);
    f.setSize(new Dimension(350, 250));
    f.setVisible(true);
}

From source file:DrawRectPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("DrawRect");
    frame.setSize(300, 200);//from w ww  .j ava 2  s  .c  om
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    Container contentPane = frame.getContentPane();
    contentPane.add(new DrawRectPanel());

    frame.show();
}

From source file:Main.java

public static void main(String[] argv) {
    final JColorChooser chooser = new JColorChooser();
    ActionListener okListener = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            Color newColor = chooser.getColor();
        }//ww  w  . j  a  va  2s .c  om
    };

    ActionListener cancelListener = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            Color newColor = chooser.getColor();
        }
    };

    boolean modal = false;

    JDialog dialog = JColorChooser.createDialog(null, "Dialog Title", modal, chooser, okListener,
            cancelListener);

    dialog.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            Color newColor = chooser.getColor();
        }
    });
}

From source file:AreaIntersect.java

public static void main(String s[]) {
    JFrame f = new JFrame("Pear");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/*  w ww .j  a  v a2 s. co  m*/
        }
    });
    JApplet applet = new AreaIntersect();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(150, 200));
    f.show();
}

From source file:DynamicHookupTest.java

public static void main(String[] args) {
    JFrame f = new DynamicHookupTest();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent we) {
            System.exit(0);/*from  w  w  w  .  j  a  v a 2  s .  com*/
        }
    });
    f.setSize(150, 150);
    f.setVisible(true);
}