返回列表 發帖
本帖最後由 李宇澤 於 2021-7-30 20:08 編輯
  1. import javax.swing.JFrame;
  2. import javax.swing.JButton;
  3. public class Ch69 {

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

  23. }
複製代碼
李宇澤Oscar

TOP

返回列表