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

  4.         public static void main(String[] args) {

  5.                 JButton btn1=new JButton("按鈕一");
  6.                 btn1.setBounds(10, 10, 220, 80);
  7.                 btn1.setEnabled(false);

  8.                 JButton btn2=new JButton("按鈕二");
  9.                 btn2.setBounds(10, 100, 220, 80);

  10.                 JFrame fm=new JFrame("JButton");
  11.                 fm.setBounds(150, 100, 250, 300);
  12.                 fm.setVisible(true);
  13.                 fm.setResizable(false);
  14.                 fm.setLayout(null);
  15.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  16.                 fm.add(btn1);
  17.                 fm.add(btn2);
  18.         }
  19. }
複製代碼

TOP

返回列表