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

public static void main(String[] a) {
    JFrame f = new JFrame();
    QuadCurve curve = new QuadCurve();
    curve.init();//from   w w w  . j a va 2  s  .  c  om
    f.getContentPane().add(curve);
    f.setDefaultCloseOperation(1);
    f.setSize(650, 250);
    f.setVisible(true);
}

From source file:EvenOddRenderer.java

public static void main(String args[]) {

    final Object rowData[][] = { { "1", "one", "I" }, { "2", "two", "II" }, { "3", "three", "III" } };
    final String columnNames[] = { "#", "English", "Roman" };

    final JTable table = new JTable(rowData, columnNames);
    JScrollPane scrollPane = new JScrollPane(table);

    table.setDefaultRenderer(Object.class, new EvenOddRenderer());

    JFrame frame = new JFrame("Resizing Table");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(scrollPane, BorderLayout.CENTER);

    frame.setSize(300, 150);
    frame.setVisible(true);// w  w w  . j a  v a2s .c  om

}

From source file:ListModelExample.java

public static void main(String s[]) {
    JFrame frame = new JFrame("List Model Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new ListModelExample());
    frame.setSize(260, 200);
    frame.setVisible(true);/*from   w  ww  .  j a v  a  2s .  c  o  m*/
}

From source file:SwingTimerBasedAnimationScaleRotate.java

public static void main(String[] args) {

    JFrame frame = new JFrame("Moving star");
    frame.add(new SwingTimerBasedAnimationScaleRotate());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(420, 250);
    frame.setLocationRelativeTo(null);//from  w  w w  .java2s  .c  o m
    frame.setVisible(true);
}

From source file:JListBackground.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Brute Force Algorithm");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    addComponentsToPane(frame.getContentPane());
    frame.pack();//from   w w  w  . j  a  v a 2s .co  m
    frame.setSize(800, 600);
    frame.setVisible(true);
}

From source file:AdornSample.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("Adornment Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setUndecorated(true);/*from   w  w  w.  ja  v a 2  s .c o  m*/
    frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    frame.setSize(300, 100);
    frame.setVisible(true);
}

From source file:OffsetTest.java

public static void main(String[] args) {
    JTextArea ta = new JTextArea();
    ta.setLineWrap(true);/*from ww  w.  j  a  v a 2 s.c o  m*/
    ta.setWrapStyleWord(true);
    JScrollPane scroll = new JScrollPane(ta);

    // Add three lines of text to the JTextArea.
    ta.append("The first line.\n");
    ta.append("Line Two!\n");
    ta.append("This is the 3rd line of this document.");

    // Print some results . . .
    try {
        for (int n = 0; n < ta.getLineCount(); n += 1)
            System.out.println("line " + n + " starts at " + ta.getLineStartOffset(n) + ", ends at "
                    + ta.getLineEndOffset(n));
        System.out.println();

        int n = 0;
        while (true) {
            System.out.print("offset " + n + " is on ");
            System.out.println("line " + ta.getLineOfOffset(n));
            n += 13;
        }
    } catch (BadLocationException ex) {
        System.out.println(ex);
    }

    // Layout . . .
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(scroll, java.awt.BorderLayout.CENTER);
    f.setSize(150, 150);
    f.setVisible(true);
}

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("Adornment Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setUndecorated(true);/*  www  .ja  v  a  2s . c  om*/
    frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    frame.setSize(300, 100);
    frame.setVisible(true);

}

From source file:UsingTableModelToContruct.java

public static void main(String args[]) {

    TableModel model = new AbstractTableModel() {
        Object rowData[][] = { { "one", "1" }, { "two", "2" }, { "three", "3" } };

        Object columnNames[] = { "English", "#" };

        public String getColumnName(int column) {
            return columnNames[column].toString();
        }/*from  w  w w  . ja  v  a  2  s.c  o  m*/

        public int getRowCount() {
            return rowData.length;
        }

        public int getColumnCount() {
            return columnNames.length;
        }

        public Object getValueAt(int row, int col) {
            return rowData[row][col];
        }
    };
    JTable table = new JTable(model);
    JScrollPane scrollPane = new JScrollPane(table);

    JFrame frame = new JFrame("Resizing Table");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(scrollPane, BorderLayout.CENTER);

    frame.setSize(300, 150);
    frame.setVisible(true);

}

From source file:UTest.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Debugging Drop Zone");
    frame.setSize(500, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JTextArea jta = new JTextArea();
    frame.getContentPane().add(new JScrollPane(jta));
    UberHandler uh = new UberHandler();
    uh.setOutput(jta);//from  w w  w.  j av  a  2s  .c  o  m
    jta.setTransferHandler(uh);

    frame.setVisible(true);
}