FlowLayout 救助
来源:互联网 发布:java box2d 编辑:程序博客网 时间:2024/05/01 06:04
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class TestFlowLayout extends JFrame { //这里为什么要用extends啊?
public TestFlowLayout(String title) {
super(title);
init();
} //这一段代码也看不懂,括号里面为什么要写上String title啊?下面为什么要用上super(title); 以及init()???
private void init() {
this.setSize(300, 300);//设置窗体的尺寸
this.setLocationRelativeTo(null);//让窗体在屏幕中居中
JPanel panel = new JPanel(); //不知道这段代码在这里的用意是什么。
FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
panel.setLayout(layout);
panel.add(new JButton("btn1"));
panel.add(new JButton("btn2"));
panel.add(new JButton("btn3"));
panel.add(new JButton("btn4"));
panel.add(new JButton("btn5"));
panel.add(new JButton("btn6"));
panel.add(new JButton("btn7"));
this.getContentPane().add(panel);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new TestFlowLayout("my first frame");
}
}
这是我们老师给我们写的一段代码,但是我看不太懂,请高手指点一点,谢谢。
- FlowLayout 救助
- 救助
- 救助~
- 救助!!!!
- FlowLayout
- FlowLayout
- FlowLayout
- FlowLayout
- FlowLayout
- FlowLayout
- FlowLayout
- 救助C#
- 高手救助
- 救助Blogger王俊
- 救助:OpenSwing Framework
- FlowLayout布局
- flex4 flowLayout
- FlowLayout布局
- Set
- myeclipse 中使用Hql editor编辑器出现错误
- Oracle聚焦网格和开发工具
- 忘掉VIsta:10多个版本的OsX操作系统明年推出
- SOA加速政府信息资源共享
- FlowLayout 救助
- 转过来的 暗恋
- 机器视觉软件EVision介绍
- Matrox Imaging Library Introduction
- NI Vision Builder for AI(Automated Inspection)
- WeKa连接数据库
- X-win32使用中文输入法的办法
- 泛型方法
- LDAP使用小结一,命令行下成批添加子目录