返回列表 發帖
  1. import javax.swing.*;
  2. public class Ch80
  3. {
  4.   public static void main(String arg[])
  5.   {
  6.    JFrame f=new JFrame("\u083c");
  7.    JLabel lb[]=new JLabel[]{new JLabel("輸入1"),new JLabel("輸入2"),new JLabel("輸入3")};
  8.    JTextField t[]=new JTextField[]{new JTextField(),new JTextField(),new JTextField()};
  9.    lb[0].setBounds(10,10,50,30);
  10.    lb[1].setBounds(10,50,50,30);
  11.    lb[2].setBounds(10,90,50,30);
  12.    t[0].setBounds(50,10,130,30);
  13.    t[1].setBounds(50,50,130,30);
  14.    t[2].setBounds(50,90,130,30);
  15.    t[1].setEnabled(false);
  16.    t[2].setEditable(false);
  17.    f.setResizable(true);
  18.    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  19.    f.setVisible(true);
  20.    f.setBounds(100,100,200,200);
  21.    f.setLayout(null);
  22.    f.add(lb[0]);
  23.    f.add(lb[1]);
  24.    f.add(lb[2]);
  25.    f.add(t[0]);
  26.    f.add(t[1]);
  27.    f.add(t[2]);
  28.   }
  29. }
複製代碼

TOP

返回列表