Example usage for javax.swing JFrame addWindowListener

List of usage examples for javax.swing JFrame addWindowListener

Introduction

In this page you can find the example usage for javax.swing JFrame addWindowListener.

Prototype

public synchronized void addWindowListener(WindowListener l) 

Source Link

Document

Adds the specified window listener to receive window events from this window.

Usage

From source file:TransformDemo.java

public static void main(String s[]) {
    JFrame f = new JFrame();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);// www.  jav  a 2  s.c o m
        }
    });
    TransformDemo p = new TransformDemo();
    f.getContentPane().add("Center", p);
    p.init();
    f.pack();
    f.setSize(new Dimension(300, 300));
    f.show();
}

From source file:CheckBoxMnemonic.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from w w  w  .  ja v a2  s.  c o  m
        }
    });
    f.getContentPane().add(new CheckBoxMnemonic());
    f.pack();
    f.setSize(new Dimension(300, 200));
    f.show();

}

From source file:Main.java

public static void main(String[] argv) {
    JFrame frame = new Main();
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/* w w w .  jav  a  2s .  c  o m*/
        }
    });

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

From source file:FontList.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from  ww  w . j av a  2 s  .co m
        }
    });
    f.setContentPane(new FontList());
    f.setSize(300, 300);
    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 2s. c  o  m*/
        }
    });
    AllAvailableFontsComboBox fontSelection = new AllAvailableFontsComboBox();
    f.getContentPane().add(fontSelection, BorderLayout.CENTER);
    f.setSize(new Dimension(350, 250));
    f.setVisible(true);
}

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);//from w w  w. j  a  va2s.  c o 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:NullLayoutPane.java

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

    frame.getContentPane().add(new NullLayoutPane(), BorderLayout.CENTER);
    // Finally, set the size of the main window, and pop it up.
    frame.setSize(600, 400);
    frame.setVisible(true);
}

From source file:AreaAdd.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  w w  . j a v a 2  s  . c om
        }
    });
    JApplet applet = new AreaAdd();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(150, 200));
    f.show();
}

From source file:MainClass.java

public static void main(String[] argv) {
    JFrame frame = new MainClass();
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/*from  w w  w .j  av a2  s .c  om*/
        }
    });

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

From source file:AreaSubtract.java

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