List of usage examples for javax.swing JFrame addWindowListener
public synchronized void addWindowListener(WindowListener l)
From source file:XORPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("XOR"); frame.setSize(300, 200);/* w ww . j a va2 s .c o m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new XORPanel()); frame.show(); }
From source file:LineBreakSample.java
public static void main(String[] args) { JFrame f = new JFrame(""); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);//w w w . ja va2 s . com } }); LineBreakSample controller = new LineBreakSample(); f.getContentPane().add(controller, "Center"); f.setSize(new Dimension(400, 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);//w w w. ja v a 2 s . com 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:de.alpharogroup.duplicate.files.panels.progressbar.ImagePanelTest.java
/** * The main method./*from w w w. j a va2 s .c o m*/ * * @param args the arguments */ public static void main(String[] args) { final JFrame frame = new JFrame(); frame.addWindowListener(new CloseWindow()); frame.setTitle("ImagePanelTest"); ApplicationContext ctx = SpringApplicationContext.getInstance().getApplicationContext(); Resource resource = ctx.getResource("classpath:images/EngineHierarchy.PNG"); Resource log4jconfig = ctx.getResource("classpath:conf/log4j/log4jconfig.xml"); try { DOMConfigurator.configure(log4jconfig.getURL()); } catch (FactoryConfigurationError e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } File imageFile = null; try { imageFile = resource.getFile(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BufferedImage image = null; try { image = javax.imageio.ImageIO.read(imageFile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ImagePanel pnlIconPanel = new ImagePanel(image); frame.add(pnlIconPanel); frame.setBounds(0, 0, 534, 336); frame.setVisible(true); }
From source file:DrawPolyPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("DrawPoly"); frame.setSize(350, 250);/*from www . j av a 2s. c om*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new DrawPolyPanel()); frame.show(); }
From source file:HelloWorldPrinter.java
public static void main(String args[]) { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame f = new JFrame("Hello World Printer"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);/*from ww w . j ava 2 s . c o m*/ } }); JButton printButton = new JButton("Print Hello World"); printButton.addActionListener(new HelloWorldPrinter()); f.add("Center", printButton); f.pack(); f.setVisible(true); }
From source file:AttributesApp.java
public static void main(String arg[]) { JFrame frame = new JFrame(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);/*w w w .j a v a2 s. c o m*/ } }); frame.getContentPane().add("Center", new AttributesApp()); frame.setSize(500, 200); frame.setVisible(true); }
From source file:FillRectPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("FillRect"); frame.setSize(300, 200);// w ww. j ava 2s . com frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new FillRectPanel()); frame.show(); }
From source file:FillPolyPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("FillPoly"); frame.setSize(300, 200);/*from w w w . j a v a2 s .c om*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new FillPolyPanel()); frame.show(); }
From source file:Pear.java
public static void main(String s[]) { JFrame f = new JFrame("Pear"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);/* www .j a v a 2 s . c o m*/ } }); JApplet applet = new Pear(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(150, 200)); f.show(); }