Flow layout small box

import java.awt.*;
import javax.swing.*;

public class Main extends JFrame{
        public static void main(String[] args) {
            // create JFrame
            Main  frame = new Main();
            //
            frame.setTitle("This is the flow layout");
            // set size
            frame.setSize(500, 500);
            // JFrame is centered on the screen
            frame.setLocationRelativeTo(null);
            // Action when JFrame is closed
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // show JFrame
            frame.setVisible(true);
        }
    public Main() {
        super.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
        add(new JTextField(8));
        add(new JLabel("+"));
        add(new JTextField(8));
        add(new JButton("="));
        add(new JTextField(8));

    }
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324693074&siteId=291194637
Recommended