返回列表 發帖
本帖最後由 余柏緯 於 2022-10-8 19:34 編輯
  1. import javax.swing.JButton;
  2. import javax.swing.JFrame;

  3. public class C507 {

  4.         public static void main(String[] args) {
  5.                 JFrame fm=new JFrame("元件配置練習");
  6.                 JButton btn1=new JButton("按鈕一");
  7.                 btn1.setBounds(10,10,175,70);
  8.                 btn1.setEnabled(false);


  9.                 JButton btn2=new JButton("按鈕二");
  10.                 btn2.setBounds(10,90,175,70);

  11.                 fm.setBounds(100,100,200,200);
  12.                 fm.setVisible(true);
  13.                 fm.setResizable(false);
  14.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  15.                 fm.setLayout(null);
  16.                 fm.add(btn1);
  17.                 fm.add(btn2);
  18.         }

  19. }
複製代碼

TOP

返回列表