Example usage for javax.swing JFrame setSize

List of usage examples for javax.swing JFrame setSize

Introduction

In this page you can find the example usage for javax.swing JFrame setSize.

Prototype

public void setSize(int width, int height) 

Source Link

Document

The width and height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

Usage

From source file:LinesDashes3.java

public static void main(String[] args) {
    LinesDashes3 lines = new LinesDashes3();
    JFrame frame = new JFrame("Lines");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(lines);/*from w w w .ja  v  a2  s. com*/
    frame.setSize(280, 270);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

}

From source file:EventQueuePanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("EventQueueTest");
    frame.setSize(300, 200);
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from  www.  j  a  v a  2s .  com
        }
    });

    Container contentPane = frame.getContentPane();
    contentPane.add(new EventQueuePanel());

    frame.show();
}

From source file:LinesDashes2.java

public static void main(String[] args) {
    LinesDashes2 lines = new LinesDashes2();
    JFrame frame = new JFrame("Lines");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(lines);// w ww .j a  v a  2 s.  co  m
    frame.setSize(280, 270);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

}

From source file:LinesDashes4.java

public static void main(String[] args) {
    LinesDashes4 lines = new LinesDashes4();
    JFrame frame = new JFrame("Lines");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(lines);/*from  w  w  w . j a  v a 2s . com*/
    frame.setSize(280, 270);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    Image image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB);

    JFrame f = new JFrame();
    f.setIconImage(image);/* ww  w  .  j  a v a  2s.  c  o m*/
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    f.setSize(600, 400);
    f.setVisible(true);

    JFileChooser chooser = new JFileChooser();
    chooser.showOpenDialog(f);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(100, 75);
    JPanel content = new JPanel(new FlowLayout());
    frame.setContentPane(content);/*from   w  ww . ja  va 2 s .  co m*/

    MaskFormatter formatter = new MaskFormatter("#");
    formatter.setValidCharacters("123456789");

    JFormattedTextField f1 = new JFormattedTextField(formatter);
    f1.setValue(null);
    f1.setColumns(1);

    content.add(f1);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame jf = new JFrame();
    Container cp = jf.getContentPane();
    MyCanvas tl = new MyCanvas();
    cp.add(tl);/*from   ww  w . j  a va2s.c  o  m*/
    jf.setSize(300, 200);
    jf.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);//from   ww w .j a v  a 2s  . c o m
            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:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(new Main());
    f.pack();//from ww  w  . ja  v  a 2 s  .  co  m
    f.setSize(400, 300);
    f.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);
    frame.setVisible(true);//from  w w  w  . j  a  v  a 2 s  .c  o m
}