返回列表 發帖
  1. import java.awt.FlowLayout;

  2. import javax.swing.JButton;
  3. import javax.swing.JFrame;

  4. public  class Ch105 {
  5.         JFrame fm;
  6.         JButton btn1, btn2, btn3, btn4, btn5, btn6;
  7.         Ch105()
  8.         {
  9.                 btn1 = new JButton("xxx");
  10.                 btn2 = new JButton("xxxxxxx");
  11.                 btn3 = new JButton("xxxxxxxxxx");
  12.                 btn4 = new JButton("xxxxxxxxx xxxxxxx");
  13.                 btn5 = new JButton("xxx");
  14.                 btn6 = new JButton("x");
  15.                
  16.             fm = new JFrame("JPanel");
  17.             fm.setBounds(100, 100, 580, 435);
  18.             fm.setVisible(true);
  19.             fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  20.             fm.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 15));
  21.             fm.add(btn1);
  22.             fm.add(btn2);
  23.             fm.add(btn3);
  24.             fm.add(btn4);
  25.             fm.add(btn5);
  26.             fm.add(btn6);
  27.                
  28.         }
  29.         public static void main(String[] args){
  30.                 new Ch105();

  31.         }

  32. }
複製代碼

TOP

返回列表