- import javax.swing.*;
- public class Ch80
- {
- public static void main(String arg[])
- {
- JFrame f=new JFrame("\u083c");
- JLabel lb[]=new JLabel[]{new JLabel("輸入1"),new JLabel("輸入2"),new JLabel("輸入3")};
- JTextField t[]=new JTextField[]{new JTextField(),new JTextField(),new JTextField()};
- lb[0].setBounds(10,10,50,30);
- lb[1].setBounds(10,50,50,30);
- lb[2].setBounds(10,90,50,30);
- t[0].setBounds(50,10,130,30);
- t[1].setBounds(50,50,130,30);
- t[2].setBounds(50,90,130,30);
- t[1].setEnabled(false);
- t[2].setEditable(false);
- f.setResizable(true);
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- f.setVisible(true);
- f.setBounds(100,100,200,200);
- f.setLayout(null);
- f.add(lb[0]);
- f.add(lb[1]);
- f.add(lb[2]);
- f.add(t[0]);
- f.add(t[1]);
- f.add(t[2]);
- }
- }
複製代碼 |