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>