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

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("Customized Event");
    frame.setSize(300, 80);
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);// w  w  w .ja va  2s.c  om
        }
    });

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

    frame.show();
}

From source file:MainClass.java

public static void main(String args[]) {
    String name = "http://urlWithClassName";
    try {/*from w w  w.  ja  v a 2s.c  o  m*/
        if (!name.endsWith(".class")) {
            System.err.println("That doesn't look like a byte code file!");
            return;
        }
        URL u = new URL(name);
        URLClassLoader ucl = new URLClassLoader(u);

        // parse out the name of the class from the URL
        String s = u.getFile();
        String classname = s.substring(s.lastIndexOf('/'), s.lastIndexOf(".class"));
        Class AppletClass = ucl.loadClass(classname, true);
        Applet apl = (Applet) AppletClass.newInstance();
        JFrame f = new JFrame();
        f.setSize(200, 200);
        f.add("Center", apl);
        apl.init();
        apl.start();
        f.setVisible(true);
    } catch (Exception e) {
        System.err.println(e);
    }
}

From source file:Textures.java

public static void main(String[] args) {
    Textures rects = new Textures();
    JFrame frame = new JFrame("Textures");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(rects);/*from   w ww  .  j a v  a 2s.c o m*/
    frame.setSize(360, 210);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

From source file:XMLTreeView.java

public static void main(String args[]) {
    JFrame frame = new JFrame("XMLTreeView: [ games.xml ]");
    frame.setSize(400, 400);

    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent ev) {
            System.exit(0);/*from  w ww  .j a v a 2 s  .  c o  m*/
        }
    });
    file = "games.xml";
    new XMLTreeView(frame);
}

From source file:Main.java

License:asdf

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);/*from   w w  w. ja v a  2  s . co  m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("Customized Event");
    frame.setSize(300, 80);
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from  w  w w  .j a v a  2 s.  c  om
        }
    });

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

    frame.setVisible(true);
}

From source file:Main.java

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

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 200);
    frame.setVisible(true);/*w  ww. java 2  s .  c  o  m*/
}

From source file:ImageFlip.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Flip image");
    frame.add(new ImageFlip());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(570, 230);
    frame.setVisible(true);/*from  w  ww  . j a va  2  s.c o  m*/
}

From source file:BasicShapes.java

public static void main(String[] args) {

    JFrame frame = new JFrame("Basic Shapes");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new BasicShapes());
    frame.setSize(350, 250);
    frame.setLocationRelativeTo(null);/*from   ww w . j a va  2 s.c  o  m*/
    frame.setVisible(true);
}

From source file:GradientsLine.java

public static void main(String[] args) {

    JFrame frame = new JFrame("GradientsLine");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new GradientsLine());
    frame.setSize(350, 350);
    frame.setLocationRelativeTo(null);//  w  w  w  .  j  a v a2 s  . c  o m
    frame.setVisible(true);
}