返回列表 發帖
  1. package q;

  2. import javax.swing.JFrame;
  3. import javax.swing.JButton;
  4. public class as {

  5.         public static void main(String[] args)
  6.         {
  7.                
  8.                 JFrame fm=new JFrame("按按鈕遊戲!!");
  9.                 JButton btn1=new JButton("不給你按");
  10.                 JButton btn2=new JButton("你敢按?");
  11.                
  12.                 btn1.setBounds(10, 10, 175, 70);
  13.                 btn1.setEnabled(false);
  14.                 btn2.setBounds(10, 90, 175, 70);
  15.                
  16.                 fm.setBounds(100, 100, 200, 200);
  17.                 fm.setVisible(true);
  18.                 fm.setResizable(false);
  19.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  20.                 fm.setLayout(null);
  21.                 fm.add(btn1);
  22.                 fm.add(btn2);
  23.                
  24.         }

  25. }
複製代碼

TOP

返回列表