import java.awt.*; import javax.swing.*; public class Main extends JFrame{ public static void main(String[] args) { // 创建JFrame Main frame = new Main(); // frame.setTitle("这是flow布局哦"); // 设置尺寸 frame.setSize(500, 500); // JFrame在屏幕居中 frame.setLocationRelativeTo(null); // JFrame关闭时的操作 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 显示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)); } }
Flow布局小框框
猜你喜欢
转载自blog.csdn.net/qq_38912284/article/details/80037753
今日推荐
周排行