import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class abc extends JFrame implements ActionListener
{
public abc()
{
JTextField jt1=new JTextField(20);
JTextField jt2=new JTextField(20);
Label lb1=new Label("请输入你要查找的汉字:");
Label lb2=new Label(" 它的前十个汉字为:");
Button btn1=new Button("确定");
Container container=getContentPane();
container.setLayout(new FlowLayout(FlowLayout.LEFT));
container.add(lb1);
container.add(jt1);
container.add(lb2);
container.add(jt2);
container.add(btn1);
btn1.addActionListener(this);
setSize(400,120);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==btn1)
jt1.setText("你好!!");
}
public static void main(String args[]){
new abc();
}
}
一个有错的程序