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(String[] args) {
    JLabel label = new JLabel("First Name");
    label.setForeground(Color.GREEN);

    JFrame frame = new JFrame();
    frame.add(label);//from   ww w . j  ava 2 s. c o m
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame("ListPanel");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(new Main());
    f.pack();//from  w  w  w.  j a v  a2s  .com
    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.add(new Main());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 200);//from w  w w  .  j  a  v a  2s . c om
    frame.setVisible(true);
}

From source file:TextLayoutDemo.java

public static void main(String[] args) {
    JFrame frame = new TextLayoutDemo();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();//from  w  ww .  ja v a 2 s  . c o  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    String url = "http://www.yahoo.com";
    JEditorPane editor = new JEditorPane(url);
    editor.setEditable(false);/*from  ww w . j a  va  2  s .co  m*/
    JScrollPane pane = new JScrollPane(editor);
    JFrame f = new JFrame("HTML Demo");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(pane);
    f.setSize(800, 600);
    f.setVisible(true);
}

From source file:SwingHtmlLabel.java

public static void main(String argv[]) {
    JPanel p = new JPanel(new java.awt.GridLayout(0, 1));
    p.add(new JLabel(markup));
    p.add(new java.awt.Label(markup));

    JFrame f = new JFrame("SwingHtmlLabel");
    f.setContentPane(p);/*from   ww  w.j a  va2 s.com*/
    f.setSize(600, 200);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");

    jb.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
            System.out.println("ItemEvent!");
        }//w  ww.j  a  v  a  2s  . c o  m
    });

    jb.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
            System.out.println("ChangeEvent!");
        }
    });

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    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.setContentPane(new Main());
    frame.pack();/* w  ww . j  av  a 2s  .co m*/
    frame.setVisible(true);
}

From source file:Main.java

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

From source file:Main.java

public static void main(String[] args) {
    JPanel pane = newPane("Label in frame");
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(pane);/* ww  w.  j  a  va  2  s  . c  o  m*/
    frame.pack();
    frame.setVisible(true);
}