List of usage examples for javax.swing JFrame addWindowListener
public synchronized void addWindowListener(WindowListener l)
From source file:ImageOps.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.j a v a 2s .c om } }); f.setContentPane(new ImageOps()); f.pack(); f.setVisible(true); }
From source file:EventQueuePanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("EventQueueTest"); frame.setSize(300, 200);//from w w w.jav a2s. c o m frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new EventQueuePanel()); frame.show(); }
From source file:EditorPaneExample4.java
public static void main(String[] args) { try {//from w ww . j a v a2 s . c o m UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) { } JFrame f = new EditorPaneExample4(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); f.setSize(500, 400); f.setVisible(true); }
From source file:ColorPan.java
public static void main(String[] args) { JFrame f = new JFrame("ColorPan"); f.getContentPane().add(new ColorPan()); f.setSize(300, 300);//from w w w.j a v a 2 s. c o m f.setLocation(100, 100); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setVisible(true); }
From source file:CompositeEffects.java
public static void main(String[] a) { JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);// ww w .ja v a2 s . c o m } }); f.setContentPane(new CompositeEffects()); f.setSize(700, 250); f.setVisible(true); }
From source file:JumbledImage.java
public static void main(String s[]) { JFrame f = new JFrame("Jumbled Image"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);/*from w w w. java2s.com*/ } }); URL imageSrc = null; try { imageSrc = ((new File(imageFileName)).toURI()).toURL(); } catch (MalformedURLException e) { } JumbledImageApplet jumbler = new JumbledImageApplet(imageSrc); jumbler.buildUI(); f.add("Center", jumbler); f.pack(); f.setVisible(true); }
From source file:PaginationExample.java
public static void main(String args[]) { try {/* w ww. ja va2 s. c o m*/ String cn = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(cn); // Use the native L&F } catch (Exception cnf) { } JFrame f = new JFrame("Printing Pagination Example"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); JButton printButton = new JButton("Print Pages"); printButton.addActionListener(new PaginationExample()); f.add("Center", printButton); f.pack(); f.setVisible(true); }
From source file:CustomEventPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Customized Event"); frame.setSize(300, 80);/* w w w . j a v a 2 s. co m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new CustomEventPanel()); frame.show(); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Customized Event"); frame.setSize(300, 80);//from w w w .j a v a2 s . com frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new Main()); frame.setVisible(true); }
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 w w w . j a va2 s.c o m*/ } }); JApplet applet = new Composite(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(300, 300)); f.show(); }