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 JFrame("Oval Sample");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new Main());
    frame.setSize(300, 200);/*  w ww . j a  v a 2 s  . com*/
    frame.setVisible(true);
}

From source file:FlowLayoutComponentOrientationRIGHT_TO_LEFT.java

public static void main(String[] argv) {
    JFrame frame = new FlowLayoutComponentOrientationRIGHT_TO_LEFT();
    frame.setDefaultCloseOperation(JFrame.EXIT_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) {
    final int w = 20;
    final int side = 25;
    final int[][] grid = new int[50][w];

    JPanel panel = new JPanel() {
        public void paintComponent(Graphics g) {
            Font font = new Font("WingDings", Font.PLAIN, 14);
            g.setFont(font);/*w ww .ja  v a2s  .com*/
            int off = 0;
            for (int i = 0; i < 256 * 256; i++) {
                if (font.canDisplay((char) i)) {
                    off++;
                    grid[off / w][off % w] = i;
                    int x = off % w * side;
                    int y = (off / w) * side + side;
                    g.drawString("" + (char) i, x, y);
                }
            }
        }
    };
    JFrame frame = new JFrame();
    panel.setSize(300, 300);
    frame.getContentPane().add(panel);
    frame.setSize(300, 300);
    frame.setVisible(true);
}

From source file:ButtonListener.java

public static void main(String[] args) {
    JPanel panel = new JPanel();

    JButton close = new JButton("Close");
    close.addActionListener(new ButtonListener());

    JButton open = new JButton("Open");
    open.addActionListener(new ButtonListener());

    JButton find = new JButton("Find");
    find.addActionListener(new ButtonListener());

    JButton save = new JButton("Save");
    save.addActionListener(new ButtonListener());

    panel.add(close);//from   w  w  w . j av  a  2s. c  o m
    panel.add(open);
    panel.add(find);
    panel.add(save);
    JFrame f = new JFrame();
    f.add(panel);
    f.setSize(400, 300);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JTabbedPane tab = new JTabbedPane();
    tab.addTab("New tab1", new JLabel("1"));
    tab.addTab("New Tab2", new JLabel("2"));
    JPanel p = new JPanel(new BorderLayout());
    p.add(new JLayer<JComponent>(tab, new TopRightCornerLabelLayerUI()));

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(p);/*from   www .  ja  v  a2 s . c  o  m*/
    f.setSize(320, 240);
    f.setVisible(true);
}

From source file:SwingSuspendResume.java

public static void main(String[] args) {
    SwingSuspendResume vsr = new SwingSuspendResume();
    Thread t = new Thread(vsr);
    t.start();// w w w  . ja v a  2 s .co  m

    JFrame f = new JFrame();
    f.setContentPane(vsr);
    f.setSize(320, 200);
    f.setVisible(true);
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
}

From source file:RussiaUnicode.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Unicode");
    frame.add(new RussiaUnicode());
    frame.setSize(520, 220);/*from   w  w  w . j av  a2 s .  c o  m*/
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:Rotate.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Rotation");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new Rotate());
    frame.setSize(300, 200);//from   w  w  w . j a v a 2 s.  c  o m
    frame.setVisible(true);
}

From source file:Main.java

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

From source file:Main.java

public static void main(String[] args) {
    String[] ITEMS1 = { "one", "two", "three", "four", "five" };
    String[] ITEMS2 = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };

    JPanel northPanel = new JPanel();
    northPanel.add(new JCheckBox("Reminder"));
    northPanel.add(new JComboBox(ITEMS1));
    northPanel.add(new JComboBox(ITEMS2));

    JPanel p = new JPanel(new BorderLayout());

    p.add(northPanel, BorderLayout.NORTH);
    p.add(new JScrollPane(new JTextArea(8, 30)), BorderLayout.CENTER);

    JFrame frame = new JFrame();
    frame.getContentPane().add(p);/*  www  .  j a  v  a 2 s.  c om*/
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
}