List of usage examples for javax.swing JFrame setVisible
public void setVisible(boolean b)
From source file:Main.java
public static void main(String args[]) { final Main it = new Main(); JFrame frame = new JFrame("Progress Bar Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(it);/*from w w w . j a v a2 s. c om*/ frame.pack(); frame.setVisible(true); for (int i = MY_MINIMUM; i <= MY_MAXIMUM; i++) { final int percent = i; try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { it.updateBar(percent); } }); java.lang.Thread.sleep(100); } catch (Exception e) { ; } } }
From source file:Main.java
public static void main(String[] arguments) { JPanel panel = new JPanel(new BorderLayout()); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel);/*from w ww .j a v a2 s. co m*/ frame.setBounds(20, 20, 200, 200); frame.setVisible(true); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); JButton loadButton = new JButton("Load memberlist"); loadButton.setEnabled(true); loadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { new Thread(new Runnable() { @Override public void run() { progressBar.setVisible(true); // do my stuff here... try { Thread.sleep(2000); } catch (Exception e) { e.printStackTrace(); } progressBar.setVisible(false); } }).start(); } }); JPanel container = new JPanel(new FlowLayout()); container.add(loadButton); container.add(progressBar); panel.add(container); }
From source file:ListTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new ListFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }/*from w ww . j a va2 s .c o m*/ }); }
From source file:Main.java
public static void main(final String[] args) throws IOException { final URL url1 = new URL("http://www.java2s.com/style/download.png"); final URL url2 = new URL("http://www.java2s.com/style/download.png"); final URL url3 = new URL("http://www.java2s.com/style/download.png"); final PictureDesktop desktop = new PictureDesktop(); desktop.addPicture(ImageIO.read(url1)); desktop.addPicture(ImageIO.read(url2)); desktop.addPicture(ImageIO.read(url3)); final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(BorderLayout.CENTER, desktop); frame.setSize(720, 480);/*from ww w.j a v a 2 s .c o m*/ frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.getContentPane().add(new MainClass()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200);// www . ja v a 2s. co m frame.setVisible(true); }
From source file:LinesDashes1.java
public static void main(String[] args) { LinesDashes1 lines = new LinesDashes1(); JFrame frame = new JFrame("Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(lines);//from ww w.ja va 2 s.c om frame.setSize(280, 270); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Main(BoxLayout.X_AXIS)); frame.pack();/*w ww. ja v a2s . c o m*/ frame.setVisible(true); }
From source file:FontDemo.java
/** Simple main program to start it running */ public static void main(String[] args) { JFrame f = new JFrame("Font Demo"); f.getContentPane().add(new JScrollPane(new FontDemo())); f.setSize(600, 700);/*w w w. ja va 2 s . c o m*/ f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:MouseClickListener.java
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("MouseListener Test 1"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addMouseListener(new MouseClickListener()); frame.setSize(200, 200);// w w w . j a v a2 s .c o m frame.setVisible(true); }
From source file:Rectangles.java
public static void main(String[] args) { Rectangles rects = new Rectangles(); JFrame frame = new JFrame("Rectangles"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(rects);/* w ww.ja va 2 s.com*/ frame.setSize(360, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); }