返回列表 發帖
  1. import javax.swing.JFrame;
  2. import javax.swing.JButton;
  3. public class Ch72 {

  4.         public static void main(String[] args) {
  5.                
  6.                 JFrame fm=new JFrame("元件配置練習");
  7.                 JButton btn1=new JButton("按鈕一");
  8.                 JButton btn2=new JButton("按鈕二");
  9.                
  10.                 btn1.setBounds(10, 10, 175, 70);
  11.                 btn1.setEnabled(false);
  12.                 btn2.setBounds(10, 90, 175, 70);
  13.                
  14.                 fm.setBounds(100, 100, 200, 200);
  15.                 fm.setVisible(true);
  16.                 fm.setResizable(false);
  17.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  18.                 fm.setLayout(null);
  19.                 fm.add(btn1);
  20.                 fm.add(btn2);
  21.                
  22.         }

  23. }
複製代碼

TOP

返回列表