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