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

public static void main(final String args[]) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("Adornment Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(300, 100);
    frame.setVisible(true);//from w ww .  j a  va 2  s.co m
}

From source file:TextRendering.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new TextRendering());
    f.setSize(800, 800);
    f.show();/* www  .j  a v  a2s . c  o m*/
}

From source file:MouseMotionEventDemo.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new MouseMotionEventDemo());
    f.setSize(200, 200);
    f.show();/*  w w w .  j a  v  a2  s.  c o  m*/
}

From source file:StaticGenerator.java

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

From source file:TextLayoutJustify.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 TextLayoutJustify());
    f.setVisible(true);//  w  w  w .  j  ava2  s .  com
}

From source file:ColorPan.java

public static void main(String[] args) {
    JFrame frame = new JFrame("ColorPan");
    frame.getContentPane().add(new ColorPan());
    frame.setSize(300, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);/*from   w  w w  .  jav a 2 s.co m*/
}

From source file:DrawStringI18N.java

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

    frame.setSize(200, 200);
    frame.setVisible(true);/*from  ww w.j  a va2  s.c  om*/
}

From source file:Main.java

public static void main(String[] arg) {
    DefaultListModel<String> listModel = new DefaultListModel<String>();
    for (int i = 0; i < 10; i++) {
        listModel.addElement("Item " + (i + 1));
    }/*from   www. ja va2 s .com*/

    JList<String> list = new JList<String>(listModel);
    list.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent me) {
            if (SwingUtilities.isRightMouseButton(me)) {
                list.clearSelection();
            }
        }
    });

    JScrollPane listScrollPane = new JScrollPane(list);
    JFrame f = new JFrame();
    f.getContentPane().add(listScrollPane);

    f.setSize(500, 400);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:MainClass.java

public static void main(String[] args) {
    JFrame frame = new MainClass();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(150, 150);
    frame.setVisible(true);/*from   w ww.j  av a  2  s . c  om*/
}

From source file:OvalBorder.java

public static void main(String[] s) {
    JFrame f = new JFrame("Oval Border");
    f.setSize(100, 100);

    JPanel p = new JPanel(new GridLayout(0, 1, 5, 5));
    JLabel l = new JLabel("Oval Border");

    l.setBorder(new OvalBorder());

    p.add(l);/*w w w. j  ava2s  .  c  o m*/
    p.setBorder(new OvalBorder());

    f.getContentPane().add(p);
    f.show();
}