返回列表 發帖
  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.         
  7.         JLabel lb1=new JLabel("輸入一");
  8.         lb1.setBounds(10, 10, 50, 30);
  9.         JLabel lb2=new JLabel("輸入二");
  10.         lb2.setBounds(10, 50, 50, 30);
  11.         JLabel lb3=new JLabel("輸入三");
  12.         lb3.setBounds(10, 90, 50, 30);
  13.         
  14.         JTextField tf1=new JTextField();
  15.         tf1.setBounds(60, 10, 120, 30);
  16.         JTextField tf2=new JTextField();
  17.         tf2.setBounds(60, 50, 120, 30);
  18.         tf2.setEnabled(false);
  19.         JTextField tf3=new JTextField();
  20.         tf3.setBounds(60, 90, 120, 30);
  21.         tf3.setEditable(false);
  22.         
  23.         JFrame fm=new JFrame("輸入框練習");
  24.         fm.setVisible(true);
  25.         fm.setResizable(false);
  26.         fm.setLayout(null);
  27.         fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  28.         fm.setBounds(100, 100, 200, 200);
  29.         fm.add(tf1);
  30.         fm.add(tf2);
  31.         fm.add(tf3);
  32.         fm.add(lb1);
  33.         fm.add(lb2);
  34.         fm.add(lb3);
  35.         }
  36. }
複製代碼

TOP

返回列表