- package ch01;
- import javax.swing.JFrame;
- import javax.swing.JButton;
- public class ch01 {
- public static void main(String[] args)
- {
- JFrame fm=new JFrame("練習");
- JButton btn1=new JButton("1");
- JButton btn2=new JButton("2");
-
- btn1.setBounds(10, 10, 175, 70);
- btn1.setEnabled(false);
- 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);
- }
- }
複製代碼 |