本人实在是不知道怎么回事,求助高手
import java.applet.*;import java.awt.*;import java.awt.event.*;public class rain05 extends Applet implements ActionListener
{ TextField text1,text2,text3;
public void init()
{ text1=new TextField(10);
text2=new TextField(10);
text3=new TextField(30);
add(text1);add(text2);add(text3);
text1.addActionListener(this);
text2.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==text1)
{ String word=text1.getText();
if(word.equals("boy"))
{ text3.setText("handsome");
}
else if(word.equals("girl"))
{text.setText("beautiful");
}
else{
text3.setText("have no this word");}
}
else if(e.getSource()==text2)
{ String word=text2.getText();
if(word.equals("goodboy"))
{ text3.setText("myself");}
else if(word.equals("badgirl"))
{ text3.setText("mygirl");}
else {
text3.setText("have no this word");}
}
}
}
这是我照书抄的程序,可编译不通过
竟然有100 个错误,小弟真是心急啊
----------------解决方案--------------------------------------------------------
我运行了一下,有一个错误。
----------------解决方案--------------------------------------------------------
请问,该怎改正那?
----------------解决方案--------------------------------------------------------
o 总算搞定了
----------------解决方案--------------------------------------------------------
----------------解决方案--------------------------------------------------------
到底要搞什么呀
----------------解决方案--------------------------------------------------------
text3.setText("beautiful");
这样就对了啊
----------------解决方案--------------------------------------------------------
[fly]怎么没用eclipse啊,你这工具有点落后啦[/fly]
----------------解决方案--------------------------------------------------------
你打的字是非法的
你用纯文本文档重新抄一下上面的程序
保证可以运行的
----------------解决方案--------------------------------------------------------
怎么还用命令行呀,用JC呀,或ELIPSE呀
----------------解决方案--------------------------------------------------------