- import javax.swing.JFrame;
- import javax.swing.JButton;
- public class Ch00 {
- 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(false);
- fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- fm.setLayout(null);
- fm.add(btn1);
- fm.add(btn2);
-
- }
- }
複製代碼 |