import javax.swing.*;
import java.awt.*;
public class GridLayoutDemo extends JFrame{
public GridLayoutDemo()
{
super("网格布局");
this.setSize(600,300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void setlayout(){
FlowLayout layout = new FlowLayout();
Container Contain = getContentPane();
Contain.setLayout(layout);
for(int i=1; i<6;i++)
{
JButton btn = new JButton("按钮"+i);
Contain.add(btn);
}
}
public static void main(String []args )
{
GridLayoutDemo GridLay = new GridLayoutDemo();
GridLay.setlayout();
GridLay.show();
}
}
posted @
2006-12-21 20:04 悠扬---靖宝华 阅读(299) |
评论 (0) |
编辑 收藏