package gui1;

import java.awt.FlowLayout;
import java.awt.GridLayout; import javax.swing.JButton;
import javax.swing.JFrame; public class gridlayout1 extends JFrame{
JButton [] a={null,null,null,null,null,null,null,null};
public static void main(String[] args) {
// TODO Auto-generated method stub
gridlayout1 g1=new gridlayout1();
}
public gridlayout1()
{ 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 GridLayout(,,,));//默认是边界布局,如果想变成其他布局,加上 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("网格布局gridlayout");
this.setSize(,);
this.setLocation(, );
this.setResizable(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true); }
}

最新文章

  1. Windows Universal 应用 – Tip Calculator
  2. 解读浮动闭合最佳方案:clearfix
  3. wamp 配置遇到的问题
  4. mybatis获得刚刚插入的自增的值
  5. UVa 10892 (GCD) LCM Cardinality
  6. ASP.NET MVC 前端(View)向后端(Controller)中传值
  7. 【Qt】Qt环境搭建(Visual Studio)【转】
  8. yzoi2223集合构造的详细解法
  9. 七夕节(hd1215)干嘛今天做这题T_T
  10. asp.net错误.在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的节是错
  11. java线程例子登山
  12. 使用dom4j解析XML例子
  13. Qt5.7 实现Https 认证全过程解析(亲自动手版)
  14. Android-Animation (1) 视图动画
  15. Junit/idea Junit支持/Spring test之间的孽世纠葛
  16. vue 关于生命周期
  17. Mycat性能调优指南
  18. Docker-安装(CentOS7)
  19. STM32 双ADC同步规则采样
  20. mxnet卷积计算

热门文章

  1. ES6 随记(2)-- 解构赋值
  2. 【转载】格式化存储装置成为 Ext2/Ext3/Ext4 档案系统
  3. 【FAQ系列】Relay log 导致复制启动失败
  4. Keepalived + LVS/DR 安装配置
  5. jQuery仿Android锁屏图案应用
  6. iOS_数据存取(一)
  7. INSPIRED启示录 读书笔记 - 第15章 特约用户
  8. leetcode刷题1:两数之和two_sum
  9. CentOS防火墙iptables-config的相关配置参数详解
  10. pandas通过字典生成dataframe