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[] av) {

    JFrame frame = new JFrame();
    Container cp = frame.getContentPane();
    cp.add(new DriveTree(new File(".")));
    frame.pack();/*  w  w  w.j a  v a2s.c  om*/
    frame.setVisible(true);
    frame.setSize(300, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame("JScrollPane Demo");

    ImageIcon ii = new ImageIcon("largeJava2sLogo.gif");
    JScrollPane jsp = new JScrollPane(new Main(ii));
    f.getContentPane().add(jsp);/*from   w  w  w .  ja va  2 s .  c  om*/
    f.setSize(300, 250);
    f.setVisible(true);

}

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new JFrame("DefaultButton");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton button1 = new JButton("Text Button");
    button1.setMnemonic(KeyEvent.VK_B);
    frame.add(button1);/*from w  w  w  . j  a  va  2s  .  c  om*/
    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String s[]) {
    JFrame frame = new JFrame("Menu Element Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new MainClass());
    frame.setSize(300, 300);
    frame.setVisible(true);/*from   www .  j  a  v  a 2  s  .co m*/
}

From source file:TimerBasedAnimation.java

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

From source file:UpcaseFilter.java

public static void main(String[] args) {
    DocumentFilter dfilter = new UpcaseFilter();

    JTextArea jta = new JTextArea();
    JTextField jtf = new JTextField();
    ((AbstractDocument) jta.getDocument()).setDocumentFilter(dfilter);
    ((AbstractDocument) jtf.getDocument()).setDocumentFilter(dfilter);

    JFrame frame = new JFrame("UpcaseFilter");
    frame.getContentPane().add(jta, "Center");
    frame.getContentPane().add(jtf, "South");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 120);
    frame.setVisible(true);//from   w ww .  ja  v  a2 s. c o m
}

From source file:Main.java

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

    JSeparator sep = new JSeparator(JSeparator.VERTICAL);
    sep.setOrientation(JSeparator.VERTICAL);
    frame.add(sep);/*from   w  w w .  j  a  va2  s  . c o  m*/

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String s[]) {
    JFrame frame = new JFrame("Popup Menu Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new MainClass());
    frame.setSize(300, 300);
    frame.setVisible(true);/*from www. j a  va  2 s. c  o m*/
}

From source file:MainClass.java

public static void main(String args[]) {
    JFrame f = new JFrame("JTree Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JTree tree = new JTree();
    JScrollPane scrollPane = new JScrollPane(tree);
    f.add(scrollPane, BorderLayout.CENTER);
    f.setSize(300, 200);
    f.setVisible(true);//from  w  w w. ja  v  a2 s.c o m
}

From source file:Main.java

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

    JPanel buttonPanel = new JPanel(new FlowLayout());
    buttonPanel.add(new JButton("A"));

    frame.add(buttonPanel);//from w  w  w  .  j  a va 2 s.c  om

    frame.setSize(300, 200);
    frame.setVisible(true);
}