Example usage for javax.swing JFrame setVisible

List of usage examples for javax.swing JFrame setVisible

Introduction

In this page you can find the example usage for javax.swing JFrame setVisible.

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Window depending on the value of parameter b .

Usage

From source file:Main.java

public static void main(final String[] av) {
    JFrame frame = new JFrame();
    Container cp = frame.getContentPane();
    cp.add(new Main(new File(".")));
    frame.pack();//from  w  w  w  .ja  v a  2  s.  c o m
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:TabComponent.java

public static void main(String[] args) {
    JTabbedPane pane = new JTabbedPane();
    String title = "Tab";
    pane.add(title, new JLabel(title));
    pane.setTabComponentAt(0, new TabComponent(title, pane));

    JFrame frame = new JFrame("Tab Component Demo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(pane);/* w w w.jav a 2 s  . co m*/
    frame.setSize(500, 200);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame("The Frame");
    f.setSize(300, 300);/*w w  w  .ja v  a2  s  .c o  m*/
    f.setLocation(100, 100);

    JWindow w = new JWindow();
    w.setSize(300, 300);
    w.setLocation(500, 100);

    f.setVisible(true);
    w.setVisible(true);
}

From source file:PaintMethods.java

/** "main program" method - construct and show */
public static void main(String[] av) {
    final JFrame f = new JFrame("PaintMethods demo");
    f.getContentPane().add("Center", new PaintMethods("Testing 1 2 3"));
    f.pack();/*from  w  w  w  .ja  v  a 2s.co  m*/
    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:Main.java

public static void main(String avg[]) throws Exception {
    BufferedImage img = ImageIO.read(new URL("http://www.java2s.com/style/download.png"));
    ImageIcon icon = new ImageIcon(img);
    JFrame frame = new JFrame();
    frame.setLayout(new FlowLayout());
    frame.setSize(200, 300);//from   w w w .  ja v  a  2  s  .  c  o  m
    JLabel lbl = new JLabel();
    lbl.setIcon(icon);
    frame.add(lbl);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:GridLayoutDemo.java

public static void main(String[] args) {
    JFrame frame = new JFrame("GridLayoutDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    addComponentsToPane(frame.getContentPane());

    frame.pack();/*w w w.  j a v  a  2 s  .  c  o m*/
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] unused) {
    JFrame f = new JFrame("FrameIcon");
    Image im = Toolkit.getDefaultToolkit().getImage("FrameIcon.gif");
    f.setIconImage(im);/*from ww w  .j  av a2s. c  o m*/
    f.setSize(100, 100);
    f.setLocation(200, 200);
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new Main());
    frame.pack();/*from   w  w w.  j a v a  2s  .  c  o m*/
    frame.setVisible(true);
}

From source file:FadeOutImage.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Fade out");
    frame.add(new FadeOutImage());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(300, 250);/* ww  w.j  av  a2  s.c  o  m*/
    frame.setVisible(true);
}

From source file:RasterImageTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new RasterImageFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        }//from  w  w  w  . j  a  va2  s .c  om
    });
}