本帖最後由 余柏緯 於 2022-10-8 19:34 編輯
- import javax.swing.JButton;
- import javax.swing.JFrame;
- public class C507 {
- public static void main(String[] args) {
- JFrame fm=new JFrame("元件配置練習");
- JButton btn1=new JButton("按鈕一");
- btn1.setBounds(10,10,175,70);
- btn1.setEnabled(false);
- JButton btn2=new JButton("按鈕二");
- btn2.setBounds(10,90,175,70);
- fm.setBounds(100,100,200,200);
- fm.setVisible(true);
- fm.setResizable(false);
- fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- fm.setLayout(null);
- fm.add(btn1);
- fm.add(btn2);
- }
- }
複製代碼 |