返回列表 發帖
  1. import javax.swing.JFrame;
  2. import javax.swing.JLabel;
  3. import javax.swing.JTextField;


  4. public class Ch80 {

  5.         public static void main(String[] args) {
  6.                 // TODO 自動產生的方法 Stub
  7.                 JTextField t1=new JTextField();
  8.                 JTextField t2=new JTextField();
  9.                 t2.setEnabled(false);
  10.                 JTextField t3=new JTextField();
  11.                 t3.setEditable(false);
  12.                 t1.setBounds(60, 10, 125, 30);
  13.                 t2.setBounds(60, 50, 125, 30);
  14.                 t3.setBounds(60, 90, 125, 30);
  15.                
  16.                 JLabel lb1=new JLabel("輸入一");
  17.                 lb1.setBounds(10, 10, 50, 30);
  18.                 JLabel lb2=new JLabel("輸入二");
  19.                 lb2.setBounds(10, 50, 50, 30);
  20.                 JLabel lb3=new JLabel("輸入三");
  21.                 lb3.setBounds(10, 90, 50, 30);
  22.                
  23.                 JFrame fm=new JFrame("輸入練習");
  24.                 fm.setBounds(100, 100, 200, 200);
  25.                 fm.setVisible(true);
  26.                 fm.setResizable(false);
  27.                 fm.setLayout(null);
  28.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  29.                 fm.add(lb1);
  30.                 fm.add(lb2);
  31.                 fm.add(lb3);
  32.                 fm.add(t1);
  33.                 fm.add(t2);
  34.                 fm.add(t3);
  35.         }

  36. }
複製代碼

TOP

返回列表