返回列表 發帖
  1. package lol;

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

  4. public class Ch01 {

  5.         public static void main(String[] args) {
  6.                 JButton btn1=new JButton("button 1");
  7.                 btn1.setBounds(10, 10, 175, 70);
  8.                 btn1.setEnabled(false);
  9.                 JButton btn2=new JButton("button 2");
  10.                 btn2.setBounds(10, 90, 175, 70);
  11.                 JFrame fm=new JFrame("button practice");
  12.                 fm.setBounds(100,100,200,200);
  13.                 fm.setVisible(true);
  14.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  15.                 fm.setResizable(false);
  16.                 fm.setLayout(null);
  17.                 fm.add(btn1);
  18.                 fm.add(btn2);

  19.         }

  20. }
複製代碼

TOP

返回列表