package chapter27;

import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JFrame;
import java.awt.FlowLayout;

public class ShowFlowLayout {

    /** Main method */
    public static void main(String[] args) {

        JFrame frame = new JFrame("ShowFlowLayout");

        FlowLayout layout =  new FlowLayout(FlowLayout.LEFT, 10, 20);
        frame.setLayout(layout);

        // Add labels and text fields to the frame
        frame.add(new JLabel("First Name"));
        frame.add(new JTextField(8));
        frame.add(new JLabel("MI"));
        frame.add(new JTextField(1));
        frame.add(new JLabel("Last Name"));
        frame.add(new JTextField(8));

        frame.setLocationRelativeTo(null); // centers the frame on the screen
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(250, 150);
        frame.setVisible(true);
    }
}
