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:Composite.java

public static void main(String s[]) {
    JFrame f = new JFrame("Composite");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/*from   www. j  a  va2  s . co  m*/
        }
    });
    JApplet applet = new Composite();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(300, 300));
    f.show();
}

From source file:CubaHSQLDBServer.java

public static void main(final String[] args) {
    final boolean validInit = args.length > 2;
    SwingUtilities.invokeLater(new Runnable() {
        @Override//www.ja v  a  2 s  . com
        public void run() {
            final CubaHSQLDBServer monitor = new CubaHSQLDBServer();
            monitor.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            monitor.setLocationRelativeTo(null);
            monitor.setVisible(true);

            if (validInit) {
                Integer dbPort = Integer.valueOf(args[0]);
                String dbPath = args[1];
                String dbName = args[2];
                final HSQLServer server = monitor.startServer(dbPort, dbPath, dbName);
                if (server != null) {
                    monitor.addWindowListener(new WindowAdapter() {
                        @Override
                        public void windowClosing(WindowEvent e) {
                            try {
                                server.shutdownCatalogs(2 /* NORMAL CLOSE MODE */);
                            } catch (RuntimeException exception) {
                                // Ignore exceptions from server.
                            }
                        }
                    });
                }
            } else {
                String argStr = StringUtils.join(args, ' ');
                monitor.setStatus(String.format(
                        "Invalid usage (args: '%s')\nExpected arguments: <port> <dbPath> <dbName>", argStr));
            }
        }
    });
}

From source file:Containers.java

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

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

From source file:MyCheckBoxUI.java

public static void main(String[] argv) {
    JFrame f = new JFrame();
    f.setSize(400, 300);//from w w  w  . j a v  a2s  . com
    f.getContentPane().setLayout(new FlowLayout());

    JPanel p = new JPanel();
    JCheckBox bt1 = new JCheckBox("Click Me");
    bt1.setUI(new MyCheckBoxUI());
    p.add(bt1);
    f.getContentPane().add(p);
    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    f.addWindowListener(wndCloser);
    f.setVisible(true);
}

From source file:com.archivas.clienttools.arcmover.gui.panels.CopyOptionsPanel.java

public static void main(String[] args) {
    // just test this panel.
    CopyOptionsPanel p = new CopyOptionsPanel(null, new CopyJob());
    JFrame f = new JFrame();
    f.add(p);/*  ww  w .j ava 2 s.c  om*/
    f.pack();
    f.setLocation(100, 800);
    f.setSize(new Dimension(700, 500));
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    f.setVisible(true);
}

From source file:org.OpenNI.Samples.UserTracker.UserTrackerApplication.java

public static void main(String s[]) {
    JFrame f = new JFrame("OpenNI User Tracker");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/*from   ww  w  .jav  a 2s  .c  o m*/
        }
    });
    UserTrackerApplication app = new UserTrackerApplication(f);

    app.viewer = new UserTracker();
    f.add("Center", app.viewer);
    f.pack();
    f.setVisible(true);
    app.run();
}

From source file:AntiAlias.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  ww.  ja va  2  s .c  om*/
        }
    });
    f.setContentPane(new AntiAlias());
    f.setSize(400, 400);
    f.setVisible(true);
}

From source file:SwingSuspendResume.java

public static void main(String[] args) {
    SwingSuspendResume vsr = new SwingSuspendResume();
    Thread t = new Thread(vsr);
    t.start();//from   w w  w.j av a2s  . co  m

    JFrame f = new JFrame();
    f.setContentPane(vsr);
    f.setSize(320, 200);
    f.setVisible(true);
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
}

From source file:ClientApp.java

public static void main(String[] args) {
    HttpClientFrame f = new HttpClientFrame();
    f.setTitle("HttpClient demo application");
    f.setSize(700, 500);/*from  ww w  . j  a v  a  2s .c  o  m*/
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    f.setVisible(true);
}

From source file:CustomStrokes.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);// w w  w  .  j a v  a  2 s  . c o  m
        }
    });
    f.setContentPane(new CustomStrokes());
    f.setSize(750, 200);
    f.setVisible(true);
}