- import javax.swing.JButton;
- import javax.swing.JFrame;
- public class Ch75 {
- public static void main(String[] args)
- {
- JButton btn1 = new JButton("按鈕一");
- btn1.setBounds(10, 10,175, 70);
- btn1.setEnabled(false);
-
- JButton btn2 = new JButton("按鈕二");
- btn2.setBounds(10, 90, 175, 70);
-
- JFrame fm = new JFrame("視窗一");
- fm.setBounds(100,100,200,200);
- fm.setVisible(true);
- fm.setResizable(true);
- fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- fm.setLayout(null);
- fm.add(btn1);
- fm.add(btn2);
- }
- }
複製代碼 |