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);
}
}
最后
以上就是潇洒小霸王最近收集整理的关于流布局管理器的全部内容,更多相关流布局管理器内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复