一段很简单的代码
import java.awt.*;import java.applet.*;
import java.awt.event.*;
public class zuoye101 extends Applet implements ActionListener
{
TextField text;
Button button;
public void init()
{
text=new TextField();
button=new Button("按钮");
add(text);
add(button);
button.addActionListener(this);
text.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{ String s=button.getLabel();
if(e.getSource()==button)
为什么这段代码有浏览器运行时,一打开浏览器就自动关闭了呢?
{
text.setText(s);
}
else if(e.getSource()==text)
{text.setText(s);
}
}
}
搜索更多相关的解决方案:
代码
----------------解决方案--------------------------------------------------------
我这好好的嘛 没的什么怪现象出来
----------------解决方案--------------------------------------------------------