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

public static void main(String[] args) {
    JFrame frame = new JFrame("Text attributes");
    frame.add(new TextAttributesStrikeThrough());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setSize(620, 190);
    frame.setLocationRelativeTo(null);/*from   w  ww. jav  a  2s .c  om*/
    frame.setVisible(true);
}

From source file:MaxLengthDocument.java

public static void main(String[] args) {
    Document doc = new MaxLengthDocument(5);
    JTextField field = new JTextField(doc, "", 8);

    JPanel flowPanel = new JPanel();
    flowPanel.add(field);/* w  ww .  ja  v  a 2s . c  om*/
    JFrame frame = new JFrame("MaxLengthDocument demo");
    frame.setContentPane(flowPanel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(160, 80);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JTextPane pane = new JTextPane();
    TabStop[] tabs = new TabStop[1];
    tabs[0] = new TabStop(60, TabStop.ALIGN_RIGHT, TabStop.LEAD_NONE);
    TabSet tabset = new TabSet(tabs);

    StyleContext sc = StyleContext.getDefaultStyleContext();
    AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.TabSet, tabset);
    pane.setParagraphAttributes(aset, false);
    pane.setText("\tright\tleft\tcenter\tdecimal\n" + "\t1\t1\t1\t1.0\n"
            + "\t200.002\t200.002\t200.002\t200.002\n" + "\t.33\t.33\t.33\t.33\n");

    JFrame frame = new JFrame("TabExample");
    frame.setContentPane(new JScrollPane(pane));
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(360, 120);
    frame.setVisible(true);//from   ww  w  .j  a  v a 2 s  .co m
}

From source file:TransformTranslatedRotation.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.getContentPane().add(new TransformTranslatedRotation());
    f.setSize(450, 350);
    f.show();// w w  w  .j a  va  2 s .c  o m
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    AdjustmentListener adjustmentListener = new AdjustmentListener() {
        public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) {
            System.out.println("Adjusted: " + adjustmentEvent.getValue());
        }//from   w  ww.ja  va 2s .  com
    };
    JScrollBar oneJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    oneJScrollBar.addAdjustmentListener(adjustmentListener);

    JFrame frame = new JFrame("ScrollBars R Us");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(oneJScrollBar, BorderLayout.NORTH);

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

From source file:RoundGradientPaintFill.java

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

From source file:SineDraw.java

public static void main(String[] args) {
    JPanel p = new Main();

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(p);/*from   w ww.  jav  a  2s . c om*/
    frame.setSize(500, 500);

    frame.setVisible(true);
}

From source file:MaxLengthDocument.java

public static void main(String[] a) {
    Document doc = new MaxLengthDocument(5); // set maximum length to 5
    JTextField field = new JTextField(doc, "", 8);

    JPanel flowPanel = new JPanel();
    flowPanel.add(field);//from  w  ww .  j ava 2 s  .  c  o  m
    JFrame frame = new JFrame("MaxLengthDocument demo");
    frame.setContentPane(flowPanel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(160, 80);
    frame.setVisible(true);
}

From source file:GridBagConstraintsSimplePanel.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(new GridBagConstraintsSimplePanel());
    f.setSize(400, 300);
    f.setVisible(true);/*www .  java 2 s  .  com*/
}

From source file:UndoStyleFrame.java

public static void main(String[] args) {
    JFrame frame = new UndoStyleFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(400, 300);
    frame.setVisible(true);/*from w  w w.  j a  va2 s. c o m*/
}