List of usage examples for javax.swing JFrame show
@Deprecated public void show()
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 va2 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:ClipImage.java
public static void main(String s[]) { final ClipImage demo = new ClipImage(); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);//from w w w .j a va 2 s. c om } public void windowDeiconified(WindowEvent e) { demo.start(); } public void windowIconified(WindowEvent e) { demo.stop(); } }; JFrame f = new JFrame("Java 2D Demo - ClipImage"); f.addWindowListener(l); f.getContentPane().add("Center", demo); f.setSize(new Dimension(400, 300)); f.show(); demo.start(); }
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);// w w w .ja v a2s . com } }); JApplet applet = new Pear(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(150, 200)); f.show(); }
From source file:MouseDragActionPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("MouseTest"); frame.setSize(300, 200);/*from w ww . j a v a 2 s. c o m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new MouseDragActionPanel()); frame.show(); }
From source file:InternalTest.java
public static void main(String args[]) { JFrame frame = new JFrame(); Container contentPane = frame.getContentPane(); JLayeredPane desktop = new JDesktopPane(); desktop.setOpaque(false);/*from w w w . jav a2 s. c o m*/ desktop.add(createLayer("One"), JLayeredPane.POPUP_LAYER); desktop.add(createLayer("Two"), JLayeredPane.DEFAULT_LAYER); desktop.add(createLayer("Three"), JLayeredPane.PALETTE_LAYER); contentPane.add(desktop, BorderLayout.CENTER); frame.setSize(300, 300); frame.show(); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame(); JButton jb1 = new JButton("Hello"); ButtonModel bm = jb1.getModel(); JButton jb2 = new JButton("World"); jb2.setModel(bm);// ww w. j a v a2 s .co m Container c = f.getContentPane(); c.add(jb1, BorderLayout.NORTH); c.add(jb2, BorderLayout.SOUTH); jb1.addActionListener(new MessageActionListener("Selected One")); jb2.addActionListener(new MessageActionListener("Selected Two")); f.pack(); f.show(); }
From source file:AlignX.java
public static void main(String args[]) { JFrame frame = new JFrame("X Alignment"); Container contentPane = frame.getContentPane(); Container panel1 = makeIt("R", Component.RIGHT_ALIGNMENT); Container panel2 = makeIt("C", Component.CENTER_ALIGNMENT); Container panel3 = makeIt("L", Component.LEFT_ALIGNMENT); contentPane.setLayout(new FlowLayout()); contentPane.add(panel1);// w ww. j a v a 2s .c o m contentPane.add(panel2); contentPane.add(panel3); frame.pack(); frame.show(); }
From source file:ButtonModelTesting.java
public static void main(String args[]) { JFrame f = new JFrame("Button Model Tester"); JButton jb1 = new JButton("Hello"); ButtonModel bm = jb1.getModel(); JButton jb2 = new JButton("World"); jb2.setModel(bm);/*from www. j a v a 2 s . c o m*/ Container c = f.getContentPane(); c.add(jb1, BorderLayout.NORTH); c.add(jb2, BorderLayout.SOUTH); jb1.addActionListener(new MessageActionListener("Selected One")); jb2.addActionListener(new MessageActionListener("Selected Two")); f.pack(); f.show(); }
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. jav a 2 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(); }
From source file:ImageOps.java
public static void main(String s[]) { JFrame f = new JFrame("ImageOps"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);/*from ww w . j av a 2 s.c o m*/ } }); JApplet applet = new ImageOps(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(550, 550)); f.show(); }