import java.awt.*;import javax.swing.*;public class FlowLayoutPositoin extends JFrame{ public FlowLayoutPositoin(){ setTitle("流布局管理器"); setSize(300,200); setVisible(true); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Container c=getContentPane(); setLayout(new FlowLayout(2,10,10)); for(int i=0;i<10;i++){ c.add(new JButton("button"+i)); } } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new FlowLayoutPositoin(); }}
添加回答
举报
0/150
提交
取消