Java FlowLayout LEFT
Syntax
FlowLayout.LEFT has the following syntax.
public static final int LEFT
Example
In the following code shows how to use FlowLayout.LEFT field.
import java.awt.Container;
import java.awt.FlowLayout;
/*from ww w .j a va 2s .c om*/
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class Main {
public static void main(String[] args) {
JFrame aWindow = new JFrame();
aWindow.setBounds(200, 200, 200, 200);
aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = aWindow.getContentPane();
content.setLayout(new FlowLayout(FlowLayout.LEFT));
content.add(new JButton("www.java2s.com"));
content.add(new JLabel("www.java2s.com"));
content.add(new JTextField("www.java2s.com"));
aWindow.setVisible(true);
}
}
Home »
Java Tutorial »
java.awt »
Java Tutorial »
java.awt »