Example usage for java.awt FlowLayout FlowLayout

List of usage examples for java.awt FlowLayout FlowLayout

Introduction

In this page you can find the example usage for java.awt FlowLayout FlowLayout.

Prototype

public FlowLayout() 

Source Link

Document

Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap.

Usage

From source file:Main.java

public Main() {

    getContentPane().setLayout(new FlowLayout());

    JPasswordField textField1 = new JPasswordField("m", 1);
    JPasswordField textField2 = new JPasswordField("mm", 2);

    getContentPane().add(textField1);//  w w w .  j a  va2  s .  c om
    getContentPane().add(textField2);

    setSize(300, 190);
    setVisible(true);
}

From source file:JTextFieldTest.java

public JTextFieldTest() {
    super("JTextField Test");

    getContentPane().setLayout(new FlowLayout());

    JTextField textField1 = new JTextField("1", 1);
    JTextField textField2 = new JTextField("22", 2);
    JTextField textField3 = new JTextField("333", 3);

    getContentPane().add(textField1);//from  www .  j  a v  a  2 s.c  om
    getContentPane().add(textField2);
    getContentPane().add(textField3);

    setSize(300, 170);
    setVisible(true);
}

From source file:Main.java

public Main() {

    FlowLayout flowLayout = new FlowLayout();
    setLayout(flowLayout);/*from   w w  w .  java2  s . co  m*/

    add(new JButton("w w w.j a v a 2 s . c o m"));
    add(new JButton("w w w.j a v a 2 s . com"));
    add(new JButton("w w w.java2s.com"));
    add(new JButton("www.j ava 2 s . c o m"));

    flowLayout.setHgap(10);
    flowLayout.setVgap(12);
}

From source file:Main.java

public Main() {
    super("JTextField Test");

    getContentPane().setLayout(new FlowLayout());

    JTextField textField1 = new JTextField("1", 1);
    JTextField textField2 = new JTextField("22", 2);
    JTextField textField3 = new JTextField("333", 3);

    getContentPane().add(textField1);/*from ww  w.j  av  a  2  s  .co m*/
    getContentPane().add(textField2);
    getContentPane().add(textField3);

    setSize(300, 170);
    setVisible(true);
}

From source file:Cal.java

/** For testing, a main program */
public static void main(String[] av) {
    JFrame f = new JFrame("Cal");
    Container c = f.getContentPane();
    c.setLayout(new FlowLayout());

    // for this test driver, hardcode 1995/02/10.
    c.add(new Cal(1995, 2 - 1, 10));

    // and beside it, the current month.
    c.add(new Cal());

    f.pack();//from   w  w  w  .  j  a v a  2 s  .c  o  m
    f.setVisible(true);
}

From source file:Main.java

public Main() {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createEtchedBorder());

    add(labelTwo);//  w  w  w . j  a v a 2s  .c o m

    JLabel labelFour = new JLabel("TitledBorder");
    labelFour.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink)));
    add(labelFour);

}

From source file:Main.java

public Main(String name) {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createStrokeBorder(new BasicStroke(0)));

    add(labelTwo);/*from w  w  w  .ja v  a2 s .c o  m*/

}

From source file:Main.java

public Main(String name) {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED));

    add(labelTwo);/*from  w ww.  java2s  .c  om*/

}

From source file:Main.java

public Main(String name) {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createStrokeBorder(new BasicStroke(0), Color.red));

    add(labelTwo);/*from   w w  w.  j  a v a2  s .co m*/

}

From source file:Main.java

public Main(String name) {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED, Color.red, Color.black));
    add(labelTwo);//from   w ww.  j  a  v  a2s. com
}