Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » 实战错误讨论  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 文本框的监视器问题,谢谢
benkhe





发贴: 11
积分: 0
于 2005-12-27 16:46 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

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:



why edited on 2005-12-27 21:46


话题树型展开
人气 标题 作者 字数 发贴时间
7317 文本框的监视器问题,谢谢 benkhe 1031 2005-12-27 16:46
5634 Re:文本框的监视器问题,谢谢 土妞 669 2005-12-27 18:42
5610 Re:文本框的监视器问题,谢谢 benkhe 20 2005-12-27 20:31
5395 Re:文本框的监视器问题,谢谢 why 281 2005-12-27 21:54
5996 Re:文本框的监视器问题,谢谢 benkhe 16 2005-12-27 22:22

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923