import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class a1 extends Applet implements ActionListener
{
TextField text1,text2,text3;
public void init()
{
text1=new TextField(10);
text1=new TextField(10);
text1=new TextField(10);
add(text1);add(text2);add(text3);
text1.addActionListener(this);//主类的实例作为text1的监视器
}
public void actionPerformed(ActionEvent e)
{
if((e.getSource()==text1)&&(text1.getText().equals("boy")))
{text3.setText("男孩");}
else if((e.getSource()==text1)&&(text1.getText().equals("girl")))
{text3.setText("女孩");}
else if((e.getSource()==text1)&&(text1.getText().equals("sun")))
{text3.setText("太阳");}
}
}
调试正确,却出现如图所示的结果,请问这是为什么?
不好意思,不会上图
只好放在附件里
Please don't use BMP, which is huge and only viewable with IE.
I have converted the 729KB BMP to a 3KB GIF with the simple PAINT program.
Embedded JPG, GIF and PNG image would be displayed at the bottom of a post: