返回列表 發帖
  1. import javax.swing.JFrame;
  2. import javax.swing.JButton;
  3. import java.awt.GridLayout;
  4. public class Ch114{
  5.     private JFrame fm=new JFrame("FlowLayout");
  6.     private JButton btn1,btn2,btn3,btn4,btn5,btn6;
  7.         Ch114()
  8.     {
  9.             JButton btn1=new JButton("xxx");
  10.             JButton btn2=new JButton("xxxxxxx");
  11.             JButton btn3=new JButton("xxxxxxxxxxx");
  12.             JButton btn4=new JButton("xxxxxxxxx  xxxxxxx");
  13.             JButton btn5=new JButton("xxx");
  14.             JButton btn6=new JButton("x");
  15.                 fm.setBounds(100, 100, 300, 200);
  16.             fm.setVisible(true);
  17.             fm.setResizable(true);
  18.             fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  19.             fm.setLayout(new GridLayout(3,2,5,5));
  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 Ch114();
  29.         }

  30. }
複製代碼

TOP

返回列表