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