返回列表 發帖
  1. import javax.swing.*;
  2. public class Ch80 {

  3.         public static void main(String[] args) {
  4.                 JFrame fm1=new JFrame("JTextField");
  5.                 JLabel lb1=new JLabel("輸入一");
  6.                 JLabel lb2=new JLabel("輸入二");
  7.                 JLabel lb3=new JLabel("輸入三");
  8.                 JTextField tf1=new JTextField();
  9.                 JTextField tf2=new JTextField();
  10.                 JTextField tf3=new JTextField();
  11.                
  12.                 tf1.setBounds(60, 10, 120, 30);
  13.                 tf2.setBounds(60, 50, 120, 30);
  14.                 tf2.setEnabled(false);
  15.                 tf3.setBounds(60, 90, 120, 30);
  16.                 tf3.setEditable(false);
  17.                
  18.                 lb1.setBounds(10, 10, 50, 30);
  19.                 lb2.setBounds(10, 50, 50, 30);
  20.                 lb3.setBounds(10, 90, 50, 30);
  21.                
  22.                 fm1.setBounds(100, 100, 200, 200);
  23.                 fm1.setVisible(true);
  24.                 fm1.setResizable(false);
  25.                 fm1.setLayout(null);
  26.                 fm1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  27.                 fm1.add(lb1);
  28.                 fm1.add(lb2);
  29.                 fm1.add(lb3);
  30.                 fm1.add(tf1);
  31.                 fm1.add(tf2);
  32.                 fm1.add(tf3);
  33.         }
  34. }
複製代碼
كخخخخخخخخخخخخخ

TOP

返回列表