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

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

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("1", new JTextField("one"));
    tabbedPane.add("2", new JTextField("two"));
    tabbedPane.setAlignmentX(1.0f);//from   ww w  . j  a  va2  s  .co m
    tabbedPane.setAlignmentY(0.0f);

    JCheckBox checkBox = new JCheckBox("Add tab");
    checkBox.setOpaque(false);
    checkBox.setAlignmentX(1.0f);
    checkBox.setAlignmentY(0.0f);

    panel.add(checkBox);
    panel.add(tabbedPane);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel);
    frame.setSize(400, 100);
    frame.setVisible(true);
}

From source file:Points.java

public static void main(String[] args) {
    Points points = new Points();
    JFrame frame = new JFrame("Points");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(points);/*w  w w  . ja v a2 s  .  com*/
    frame.setSize(250, 200);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] args) {
    JFrame jf = new JFrame("Demo");
    Container cp = jf.getContentPane();
    MyCanvas tl = new MyCanvas();
    cp.add(tl);//  w ww. j  a  v a  2  s  .  co  m
    jf.setSize(300, 200);
    jf.setVisible(true);
}

From source file:BevelExample.java

public static void main(String s[]) {
    JFrame frame = new JFrame("Bevel Border");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(400, 100);
    frame.setContentPane(new BevelExample());
    frame.setVisible(true);//www . j  a va2s . co m
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setSize(300, 300);
    f.setLocationRelativeTo(null);//from  w  w  w. j  a v a  2  s  .  co  m

    f.setUndecorated(true);
    f.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);

    JPanel panel = new JPanel();
    panel.setBackground(java.awt.Color.white);
    f.setContentPane(panel);

    MetalLookAndFeel.setCurrentTheme(new MyDefaultMetalTheme());
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (Exception e) {
        e.printStackTrace();
    }

    SwingUtilities.updateComponentTreeUI(f);

    f.setVisible(true);
}

From source file:Main.java

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

    frame.add(new Main(), BorderLayout.CENTER);
    frame.setSize(300, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);/* w ww .  ja va 2  s  . c  o m*/
}

From source file:MainClass.java

public static void main(String argv[]) {
    JFrame f = new MainClass();
    f.setSize(400, 180);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);//w w  w.  ja v a  2 s  .  c  o  m
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Basic Shapes");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new Main());
    frame.setSize(350, 250);
    frame.setLocationRelativeTo(null);//w  w  w.  j a  v  a 2 s.com
    frame.setVisible(true);
}

From source file:Main.java

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

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(p);/*w w  w  .j ava 2 s .  c  o  m*/
    frame.setSize(300, 300);

    frame.setVisible(true);
}

From source file:Translation.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Translation");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new Translation());
    frame.setSize(300, 200);
    frame.setVisible(true);/*from  ww  w  .  j a va  2  s  . com*/
}