package test;
import java.awt.*;
import javax.swing.*;
public class J090701 extends JFrame{
JButton bu1,bu2,bu3,bu4,bu5,bu6,bu7;
public static void main(String[] args) {
J090701 j07=new J090701();
}
public J090701() {
bu1=new JButton("苹果");
bu2=new JButton("香蕉");
bu3=new JButton("荔枝");
bu4=new JButton("梨");
bu5=new JButton("桃子");
bu6=new JButton("李子");
bu7=new JButton("杏子");
this.setLayout(new FlowLayout());//添加布局管理器,java中默认为边界布局管理器
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setLayout(new FlowLayout(FlowLayout.RIGHT));
this.setLayout(new FlowLayout(FlowLayout.CENTER));
this.add(bu1);
this.add(bu2);
this.add(bu3);
this.add(bu4);
this.add(bu5);
this.add(bu6);
this.add(bu7);
this.setTitle("流式布局FlowLayout练习");
this.setSize(500, 120);
this.setLocation(100, 100);
this.setResizable(false);//设置界面最大最小化
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
}