里面这段代码哪里错了,我这里执行没效果,HELP

binghe7 2003-09-18 02:06:59
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
class MyButton extends Button implements ActionListener,TextListener
{
TextArea text1,text2;
MyButton(String s)
{
super(s);
text1=new TextArea(8,8);
text2=new TextArea(10,10);
text1.addTextListener(this);
this.addActionListener(this);
}
public void textValueChanged(TextEvent e)
{
text2.setText(text1.getText());
}
public void actionPerformed(ActionEvent e)
{
text1.setText(null);
}
}
public class Example9_4 extends Applet implements ActionListener
{
MyButton button;
public void init()
{
button=new MyButton("点击我看能发生什么");
button.addActionListener(this);
add(button.text1);add(button.text2);add(button);
}
public void actionPerformed(ActionEvent e)
{
button.text1.setText(button.getLabel());
button.text2.setText("OK");
}
}
...全文
54 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
stamp80 2003-09-21
  • 打赏
  • 举报
回复
干吗不揭帖。想被扣信誉分吗
binghe7 2003-09-18
  • 打赏
  • 举报
回复
不知道为什么,早上运行时一片空白,现在又可以啦~
呵呵,郁闷,谢谢大家啦
stamp80 2003-09-18
  • 打赏
  • 举报
回复
有效果
cowboy1114 2003-09-18
  • 打赏
  • 举报
回复
确实运行啊
wangyanqiu 2003-09-18
  • 打赏
  • 举报
回复


有效果!
loveyousomuch 2003-09-18
  • 打赏
  • 举报
回复
我运行了一下,没有什么问题,你指的没效果是什么意思?
snap2008cn 2003-09-18
  • 打赏
  • 举报
回复
在jcreator 2。5里有效果啊
没有错啊

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧