本帖最後由 李宇澤 於 2021-7-30 20:08 編輯
- import javax.swing.JFrame;
- import javax.swing.JButton;
- public class Ch69 {
- public static void main(String[] args) {
-
- JFrame n=new JFrame("元件配置練習");
- JButton button1=new JButton("按鈕一");
- JButton button2=new JButton("按鈕二");
-
- button1.setBounds(10, 10, 175, 70);
- button1.setEnabled(false);
- button2.setBounds(10, 90, 175, 70);
-
- n.setBounds(100, 100, 200, 200);
- n.setVisible(true);
- n.setResizable(false);
- n.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- n.setLayout(null);
- n.add(button1);
- n.add(button2);
-
- }
- }
複製代碼 |