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) {
    JFrame frame = new ProgressBarFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:ShadowText.java

public static void main(String[] args) throws IOException {
    JFrame f = new JFrame();
    f.add(new ShadowText());
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setSize(450, 150);/*from   ww w .ja  va 2s.c om*/

    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    JFrame parent = new JFrame();
    parent.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    parent.setSize(300, 300);/*from  w  w w  . j  a v a 2  s.co  m*/
    parent.setVisible(true);
    Main dlg = new Main(parent);
    dlg.setVisible(true);
}

From source file:MainClass.java

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

    jb.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
            System.out.println("ItemEvent!");
        }/*from  ww w . j  a v a  2  s .  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[]) {
    Object rowData[][] = { { "Row1-Column1", "Row1-Column2", "Row1-Column3" },
            { "Row2-Column1", "Row2-Column2", "Row2-Column3" } };
    Object columnNames[] = { "Column 1", "Column 2", "Column 3" };

    JTable table = new JTable(rowData, columnNames);
    table.setTableHeader(null);/*from   w  w  w .  j a v  a 2 s.  c o  m*/
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setColumnHeaderView(null);
    JFrame frame = new JFrame();
    frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JComboBox<Object> combo = new JComboBox<>();
    URL url = new Main().getClass().getResource("animated.gif");
    combo.setModel(new DefaultComboBoxModel(new Object[] { makeImageIcon(url, combo, 0) }));

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(combo);//from   www.  j  a v  a 2s.  co m
    f.setSize(320, 240);
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {

    JTable table = new JTable(5, 5) {
        @Override/*from   w w w . ja  v a2s  .c  om*/
        public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
            Component comp = super.prepareRenderer(renderer, row, col);
            ((JLabel) comp).setHorizontalAlignment(JLabel.RIGHT);
            return comp;
        }
    };
    table.setPreferredScrollableViewportSize(table.getPreferredSize());
    JScrollPane scrollPane = new JScrollPane(table);

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

From source file:Main.java

public static void main(String[] args) {
    Color myColor = new Color(0XFFFFFFFF, true);

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);/*from   w ww. j  ava  2 s .  c om*/

    JFrame frame = new JFrame();
    frame.add(label);
    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) {
    Color myColor = Color.RED;

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor.darker());

    JFrame frame = new JFrame();
    frame.add(label);/*from w w  w  .  ja  v a  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) {
    Color myColor = new Color(0XFFFFFF);

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);//ww  w . j a  v a2 s  .c o m

    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);
    frame.setVisible(true);

}