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 f = new JFrame("JColorChooser Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    f.setSize(300, 200);//from  w  w  w .j a  v a2s .  c o  m
    f.setVisible(true);

    FontMetrics metrics = f.getFontMetrics(f.getFont());

    int widthX = metrics.charsWidth(new char[] { 'a', 'b' }, 1, 2);

    System.out.println(widthX);

}

From source file:Main.java

public static void main(String args[]) {
    JFrame f = new JFrame("JColorChooser Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    f.setSize(300, 200);//  w  w  w. ja va2 s. c  om
    f.setVisible(true);

    FontMetrics metrics = f.getFontMetrics(f.getFont());

    int widthX = metrics.charWidth((int) 'C');

    System.out.println(widthX);

}

From source file:Main.java

public static void main(String args[]) {
    JFrame f = new JFrame("JColorChooser Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    f.setSize(300, 200);//from w  ww  . j a  v  a 2 s  .  com
    f.setVisible(true);

    FontMetrics metrics = f.getFontMetrics(f.getFont());

    int widthX = metrics.charWidth('X');

    System.out.println(widthX);

}

From source file:Main.java

public static void main(String args[]) {
    JFrame f = new JFrame("JColorChooser Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    f.setSize(300, 200);//ww  w .j  a  v  a  2s. c o m
    f.setVisible(true);

    FontMetrics metrics = f.getFontMetrics(f.getFont());

    int widthX = metrics.bytesWidth(new byte[] { 66, 67, 68, 69 }, 1, 2);

    System.out.println(widthX);

}

From source file:MyLabel.java

public static void main(String[] args) {
    String lyrics = "<html>Line<br>line<br>line</html>";

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout(10, 10));

    JLabel label = new JLabel(lyrics);
    label.setFont(new Font("Georgia", Font.PLAIN, 14));
    label.setForeground(new Color(50, 50, 25));

    panel.add(label, BorderLayout.CENTER);
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    JFrame f = new JFrame();
    f.add(panel);/* www  .j av a2s. c  o  m*/
    f.pack();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.setSize(400, 400);/*w  w  w .j ava  2 s. c om*/
    f.add(new MainClass());
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(pb);//  w ww  .j ava 2  s .c  om
    f.pack();
    f.setVisible(true);

    Timer timer = new Timer(50, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            progress += 1;
            if (progress >= 100) {
                progress = 100;
                ((Timer) e.getSource()).stop();
            }
            pb.setValue(progress);
        }
    });
    timer.start();
}

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new Main();
    frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
    frame.setSize(20, 200);/*from   w  w  w  . j ava 2  s.c o m*/

    frame.setVisible(true);
}

From source file:RollingText.java

public static void main(String[] args) {
    JFrame f = new JFrame("RollingText v1.0");
    f.getContentPane().add(new RollingText());
    f.setSize(600, 300);/*from   ww w .  j av a 2 s.com*/
    f.setVisible(true);
}

From source file:Main.java

public static void main(String s[]) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(new Main());
    f.setSize(220, 220);//from   w w w  . j a va 2s . c om
    f.setVisible(true);
}