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:TextBox3D.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.add(new TextBox3D("Help Me", 200, 200));
    f.setSize(300, 300);//w  w  w.j  av  a2s  .  c  o m
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new PaneWithScrollFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DefaultTableModel model = new DefaultTableModel();
    JTable table = new JTable(model);
    model.addColumn("Col1");
    model.addRow(new Object[] { "r1" });
    model.addRow(new Object[] { "r2" });
    model.addRow(new Object[] { "r3" });

    Vector data = model.getDataVector();
    Vector row = (Vector) data.elementAt(1);

    int mColIndex = 0;
    List colData = new ArrayList(table.getRowCount());
    for (int i = 0; i < table.getRowCount(); i++) {
        row = (Vector) data.elementAt(i);
        colData.add(row.get(mColIndex));
    }/*from w w  w. j av a 2  s  . c  om*/

    // Append a new column with copied data
    model.addColumn("Col3", colData.toArray());

    JFrame f = new JFrame();
    f.setSize(300, 300);
    f.add(new JScrollPane(table));
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] argv) {
    DefaultTableModel model = new DefaultTableModel() {
        public Class getColumnClass(int columnIndex) {
            Object o = getValueAt(0, columnIndex);
            if (o == null) {
                return Object.class;
            } else {
                return o.getClass();
            }//from w  w w .  j a  v a  2 s .c om
        }
    };
    JTable table = new JTable(model);

    model.addColumn("Boolean", new Object[] { Boolean.TRUE });
    model.addColumn("Date", new Object[] { new Date() });
    model.addColumn("Double", new Object[] { new Double(Math.PI) });
    model.addColumn("Float", new Object[] { new Float(1.2) });
    model.addColumn("Icon", new Object[] { new ImageIcon("icon.gif") });
    model.addColumn("Number", new Object[] { new Integer(1) });
    model.addColumn("Object", new Object[] { "object" });

    JFrame f = new JFrame();
    f.setSize(300, 300);
    f.add(new JScrollPane(table));
    f.setVisible(true);
}

From source file:TrueTypeJokerman.java

public static void main(String[] args) {
    JFrame frame = new TrueTypeJokerman();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();/*from   w  w w. j  a va 2  s  .c  om*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame aWindow = new Main();
    aWindow.setSize(200, 200);//ww w.j a  va  2  s . c o m
    aWindow.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new Main());
    f.setSize(850, 250);/*  w  ww .  ja v a2  s  .  c o  m*/
    f.setVisible(true);

}

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("Adornment Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(300, 100);/*from w  w w.  j a v  a2  s.  co  m*/
    frame.setVisible(true);
}

From source file:TrueTypeTest.java

public static void main(String[] args) {
    JFrame frame = new TrueTypeTest();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

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

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setSelected(true);// ww w  . j a  va2  s  .  co m

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}