FlowLayout.LEFT : FlowLayout « java.awt « Java by API






FlowLayout.LEFT

 

import java.awt.Container;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class MainClass {

  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);
  }
}
           
         
  








Related examples in the same category

1.FlowLayout.RIGHT
2.new FlowLayout(int align)
3.new FlowLayout(int align, int hgap, int vgap)