- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- public class Ch80 {
- public static void main(String[] args) {
- // TODO 自動產生的方法 Stub
- JTextField t1=new JTextField();
- JTextField t2=new JTextField();
- t2.setEnabled(false);
- JTextField t3=new JTextField();
- t3.setEditable(false);
- t1.setBounds(60, 10, 125, 30);
- t2.setBounds(60, 50, 125, 30);
- t3.setBounds(60, 90, 125, 30);
-
- JLabel lb1=new JLabel("輸入一");
- lb1.setBounds(10, 10, 50, 30);
- JLabel lb2=new JLabel("輸入二");
- lb2.setBounds(10, 50, 50, 30);
- JLabel lb3=new JLabel("輸入三");
- lb3.setBounds(10, 90, 50, 30);
-
- JFrame fm=new JFrame("輸入練習");
- fm.setBounds(100, 100, 200, 200);
- fm.setVisible(true);
- fm.setResizable(false);
- fm.setLayout(null);
- fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- fm.add(lb1);
- fm.add(lb2);
- fm.add(lb3);
- fm.add(t1);
- fm.add(t2);
- fm.add(t3);
- }
- }
複製代碼 |