运行成功,可是URL链接不上。程序如一下::
import java.applet.*;import java.awt.*;import java.awt.event.*;import java.net.*;
public class internet extends Applet implements ActionListener
{Button b;URL url;TextField text;
public void init()
{b=new Button("ok,单击按钮就会链接到下边的网址");
text=new TextField("http://www.baidu.com",39);
add(b);add(text);
b.addActionListener(this);
}
public void actionPerformed(ActionEvent e )
{if(e.getSource()==b)
{try
{
url=new URL("http://www.baidu.com");
text.setText("please wait for me for a while,thank u");
}
catch(MalformedURLException ee)
{System.out.println("bad url");
}
getAppletContext().showDocument(url);
}
else
{}
}
}
<applet code=internet.class width=300 height=400>
</applet>
问题点数:10、回复次数:2Top
1 楼lorylxw()回复于 2005-04-03 02:02:16 得分 10
你想输出什么?Top
2 楼zgl168(夏天的清凉)回复于 2005-04-03 14:23:38 得分 0
是想链接到一个网址!
Top




