import javax.swing.*;
import java.awt.*;
public class Test extends JPanel implements ActionListener{
JLabel l;
JTextField t;
JButton jb1;
public Test(){
l = new JLabel("标签",0);
t= new JTextField("",10);
jb1 = new JButton("确定");
jb1.addActionListener(this);
setLayout(new GridLayout(3,1));
add(t);
add(l);
add(jb1);
}
public void actionPerformed(ActionEvent e){
l.setText(t.getText());
}
}
用swing啊,