import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
//1.继承 JFrame类
//2.在最上方定义组件
//3.在构造方法中创建组件
//4、在构造方法中添加组件
//5.设置窗体属性
//6.显示窗体
//7.在主函数中创建对象 public class flowlayout1 extends JFrame{
JButton [] a={null,null,null,null,null,null,null,null};
public static void main(String[] args) {
// TODO Auto-generated method stub
flowlayout1 f1=new flowlayout1();
} public flowlayout1 ()
{
a[]=new JButton("瓜子");
a[]=new JButton("话梅");
a[]=new JButton("西瓜");
a[]=new JButton("草莓");
a[]=new JButton("香蕉");
a[]=new JButton("苹果");
a[]=new JButton("栗子");
a[]=new JButton("黄瓜");
//a[8]=new JButton("葡萄"); this.setLayout(new FlowLayout(FlowLayout.LEADING));//默认是边界布局,如果想变成其他布局,加上 this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]); this.setTitle("流式布局flowlayout");
this.setSize(,);
this.setLocation(, );
this.setResizable(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true); }
}

最新文章

  1. JS实现页面加载完毕之前loading提示效果
  2. 用SysTick做的延时计时器
  3. 关于 mysqladmin
  4. iOS 详细解释@property和@synthesize关键字
  5. 悟透Javascript之 原型prototype
  6. 基于visual Studio2013解决C语言竞赛题之0517矩阵
  7. shell小脚本工具合集
  8. Android灯光系统--深入理解背光灯
  9. Unity 游戏框架搭建 (五) 简易消息机制
  10. Ionic3学习笔记(一)安装、项目结构与常用命令
  11. Jquery测试题
  12. 【转】Steam 开发者收入计算
  13. C#杂记-隐式类型的局部变量
  14. 判断语句之if...else
  15. Android常用的工具类SharedPreferences封装类SPUtils
  16. L1-061 新胖子公式
  17. pytest 1.简单介绍一,安装和如何运行
  18. GigE IP地址配置
  19. 图片路径中含有中文在jsp下不能正常显示的问题
  20. EXCEL行倒叙

热门文章

  1. php备份mysql数据库
  2. WEB网页专业词汇 汇总
  3. win10系统修改Intel VT-x时进入不了BIOS问题
  4. Redis的分布式配置
  5. 【HackerRank】Sherlock and MiniMax
  6. 释放Linux系统缓存
  7. SOA 面向服务架构 阅读笔记(四)
  8. 自己的第一个MapReduce程序
  9. golang注册码
  10. Win32 API编程:WinMain无法重载函数或_tWinMain无法重载