返回列表 發帖
  1. import java.awt.FlowLayout;
  2. import javax.swing.JButton;
  3. import javax.swing.JFrame;

  4. public class Ch01 {

  5.         JFrame fm;
  6.         JButton btn1,btn2,btn3,btn4,btn5,btn6;

  7.         Ch01()
  8.         {
  9.                 btn1=new JButton("xxx");
  10.                 btn2=new JButton("xxxxxxx");
  11.                 btn3=new JButton("xxxxxxxxxxx");
  12.                 btn4=new JButton("xxxxxxxxx    xxxxxxx");
  13.                 btn5=new JButton("xxx");
  14.                 btn6=new JButton("x");

  15.                 fm=new JFrame("FlowLayout");
  16.                 fm.setBounds(100, 100, 580, 435);
  17.                 fm.setVisible(true);
  18.                 fm.setLayout(new FlowLayout(FlowLayout.LEFT,5,10));
  19.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  20.                 fm.add(btn1);
  21.                 fm.add(btn2);
  22.                 fm.add(btn3);
  23.                 fm.add(btn4);
  24.                 fm.add(btn5);
  25.                 fm.add(btn6);
  26.         }

  27.         public static void main(String[] args) {
  28.                 new Ch01();
  29.         }
  30. }
複製代碼
我是嘉禾豬   我是嘉禾豬   我是嘉禾豬

TOP

返回列表