返回列表 發帖
  1. import javax.swing.JFrame;
  2. import javax.swing.JButton;
  3. import java.awt.FlowLayout;
  4. public class ch113
  5. {
  6.         JFrame fm;
  7.     JButton btn1,btn2,btn3,btn4,btn5,btn6;
  8.     ch113()
  9.     {
  10.            
  11.             JButton btn1=new JButton("xxx");
  12.             JButton btn2=new JButton("xxxxxxx");
  13.             JButton btn3=new JButton("xxxxxxxxxxx");
  14.             JButton btn4=new JButton("xxxxxxxxx    xxxxxxx");
  15.             JButton btn5=new JButton("xxx");
  16.             JButton btn6=new JButton("x");
  17.             
  18.             fm=new JFrame("FlowLayout");
  19.             fm.setBounds(100, 100, 300, 200);
  20.             fm.setVisible(true);
  21.             fm.setResizable(true);
  22.             fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  23.             fm.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10));  
  24.             fm.add(btn1);
  25.             fm.add(btn2);
  26.             fm.add(btn3);
  27.             fm.add(btn4);
  28.             fm.add(btn5);
  29.             fm.add(btn6);
  30.     }
  31.    
  32.     public static void main(String[] args)
  33.     {
  34.             new ch113();
  35.     }
  36.    
  37. }
複製代碼

TOP

返回列表