jasonwing27
发贴: 66
积分: 0
|
于 2004-10-14 12:53
运行后我输入菜名后回车,输出的菜名和号码都是菜名 在输入号码后回车,则输出的都是号码 不知道程序错在哪了,请各位指点
import java.applet.Applet; import java.awt.*; public class GainedApp2 extends Applet { Label words ; TextField inputwords ; Label outputwords ; Label OID ; TextField inputnumber ; Label outputnumber ; public void init() { setLayout(new GridLayout(8, 4)); words = new Label ( "输入几个字符您要的菜名 :") ; inputwords = new TextField(7) ; outputwords = new Label (" ") ; OID = new Label ( "输入您的取货号码 : ") ; inputnumber = new TextField(3) ; outputnumber = new Label (" ") ; add (words) ; add (inputwords) ; add (outputwords) ; add (OID) ; add (inputnumber ) ; add (outputnumber) ; } public boolean action (Event e, Object o) { outputwords.setText ("你需要的菜是 :"+o.toString()) ; outputnumber.setText ("你的取货号是 :"+o.toString()) ; return true ; } }
|