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

public static void main(String[] argv) {
    JTree tree = new JTree();

    tree.setRowHeight(0);//from   w  ww  .  ja v a 2 s  .  c  o  m

    JFrame frame = new JFrame("tree row height calculation");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new JScrollPane(tree));
    frame.setSize(380, 320);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.getContentPane().add(new Main().makeUI());
    f.setSize(320, 320);
    f.setVisible(true);/*from  w  ww. j  av  a 2 s.c  o  m*/
}

From source file:TransformShear.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.getContentPane().add(new TransformShear());
    f.setSize(450, 350);
    f.show();/*from  w w  w .ja v  a2  s. c om*/
}

From source file:MainClass.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(new ButtonDemo());
    f.setSize(500, 500);
    f.setVisible(true);//w  w  w.  j av  a2  s. c  o  m
}

From source file:TextAttributesColor.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Text attributes");
    frame.add(new TextAttributesColor());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setSize(620, 190);
    frame.setLocationRelativeTo(null);/*from w w  w .j a  va 2s.co  m*/
    frame.setVisible(true);
}

From source file:FadeOutImage.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Fade out");
    frame.add(new FadeOutImage());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(300, 250);
    frame.setVisible(true);//from w ww.  java2  s .  com
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    MaskFormatter formatter = new MaskFormatter("###-##-####");
    JFormattedTextField tf = new JFormattedTextField(formatter);
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(tf, BorderLayout.NORTH);
    JButton clickBtn = new JButton("Click me!");
    clickBtn.addActionListener(e -> {
        if (!tf.getText().matches(formatter.getMask())) {
            System.err.println("Your Input does not match the pattern!");
        } else {/*from  ww  w  .j a  v  a  2  s .  c o  m*/
            System.out.println(tf.getText());
        }
    });
    panel.add(clickBtn, BorderLayout.SOUTH);
    JFrame f = new JFrame();

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(panel, BorderLayout.CENTER);
    f.setSize(800, 600);
    f.setVisible(true);
}

From source file:TextAttributesFont.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Text attributes");
    frame.add(new TextAttributesFont());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setSize(620, 190);
    frame.setLocationRelativeTo(null);// w w w . j a v  a  2  s. c  om
    frame.setVisible(true);
}

From source file:GradientsDirection.java

public static void main(String[] args) {

    JFrame frame = new JFrame("GradientsDirection");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new GradientsDirection());
    frame.setSize(350, 350);
    frame.setLocationRelativeTo(null);//from   w  w  w.  ja  va 2 s .c o  m
    frame.setVisible(true);
}

From source file:ActionExampleSwing.java

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