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[] a) {
    JFrame f = new JFrame();
    f.add(new Main());

    f.setSize(300, 300);
    f.setVisible(true);//from  w  w w  .j a v a2 s.com
}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(new Character(' '), 0), "none");

    JFrame f = new JFrame();
    f.add(component);/*from w ww  . j a v a2 s .co m*/

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed -"), "actionName");

    JFrame f = new JFrame();
    f.add(component);/*from  w  w  w  . j  a  va2  s. c om*/

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed a"), "actionName");

    JFrame f = new JFrame();
    f.add(component);//from   ww w  .  ja v  a 2 s .  c  o m

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed X"), "none");

    JFrame f = new JFrame();
    f.add(component);//  w w  w.ja v a 2  s .co m

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed $"), "actionName");

    JFrame f = new JFrame();
    f.add(component);/*w w  w  .j av a  2s  . co m*/

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:DoubleBufferWithBufferedImage.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.setSize(300, 300);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(new DoubleBufferWithBufferedImage());
    f.setVisible(true);/*w  w w  . ja  va  2  s  . c  o  m*/
}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(new Character(' '), 0),
            "actionName");

    JFrame f = new JFrame();
    f.add(component);/*  ww w.  j av a  2s . c  o  m*/

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

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

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("shift pressed SPACE"),
            "actionName");

    JFrame f = new JFrame();
    f.add(component);//from   w  w w. j  av a  2  s. c o m

    f.setSize(300, 300);

    f.setVisible(true);

}