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>
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>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货