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

public static void main(String[] argv) {
    JFrame f = new JFrame();
    f.setSize(400, 300);
    f.setLayout(new FlowLayout());

    JPanel p = new JPanel();
    JCheckBox bt1 = new JCheckBox("Click Me");
    bt1.setUI(new MyCheckBoxUI());
    p.add(bt1);/*from ww  w .j a  va2s.  c  o  m*/
    f.add(p);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:HorizontallyCenteredText.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new HorizontallyCenteredText());
    f.setSize(450, 350);
    f.show();//from w  ww.j  a v  a 2  s.  c  om
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new Main());
    f.setSize(850, 250);
    f.setVisible(true);//w ww .ja  va  2s .co m

}

From source file:RowNumberHeader.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.add(new RowNumberHeader(new JTable(3, 4)));
    f.setSize(300, 300);
    f.setVisible(true);/*from   w w  w  . j  av a2 s  .c o  m*/
}

From source file:FontDerivation.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new FontDerivation());
    f.setSize(350, 250);
    f.show();//from  w ww . j av a 2 s  . c o m
}

From source file:FillPolyPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("FillPoly");
    frame.setSize(300, 200);
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);// w w w. j  ava 2  s .  c  o  m
        }
    });
    Container contentPane = frame.getContentPane();
    contentPane.add(new FillPolyPanel());

    frame.show();
}

From source file:TexturePaintFill.java

public static void main(String[] args) throws Exception {
    JFrame f = new JFrame();
    f.getContentPane().add(new TexturePaintFill());
    f.setSize(350, 250);
    f.show();/* w w w  .j av a  2  s  .  c o m*/
}

From source file:RotatedText.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Rotated text");
    frame.add(new RotatedText());
    frame.setSize(400, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);/*from  w  w  w .  j ava2s  .co  m*/
    frame.setVisible(true);
}

From source file:JDK6TextComponentDemo.java

public static void main(String[] args) throws Exception {
    final JTextArea textArea = new JTextArea();
    textArea.setText("text");
    JScrollPane jScrollPane = new JScrollPane(textArea);
    final MessageFormat header = new MessageFormat("My Header");
    final MessageFormat footer = new MessageFormat("My Footer");

    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(jScrollPane, BorderLayout.CENTER);

    JFrame frame = new JFrame();
    frame.setTitle("Text-component Printing Demo");
    frame.setSize(400, 200);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setContentPane(contentPane);//from ww  w .j a  v  a2  s . co  m
    frame.setVisible(true);
    textArea.print(header, footer, true, null, null, true);

}

From source file:ProxyTester.java

public static void main(String[] args) {
    JTabbedPane tabbedPane = new JTabbedPane();
    for (String name : imageNames) {
        JLabel label = new JLabel(new ImageProxy(name));
        tabbedPane.add(name, label);/*from  w w w .  j av  a 2s  . com*/
    }

    JFrame frame = new JFrame();
    frame.add(tabbedPane);

    frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}