使浏览器访问URL
import java.applet.Applet; import java.awt.Graphics; /* 时 代 J a v a 公 众 号 - nowjava.com 提供 */ import java.net.MalformedURLException; import java.net.URL; class BasicApplet extends Applet { // This method is called once by the browser when it starts the applet. public void init() { try { URL url = new URL(getDocumentBase(), "http://hostname.com/page.html"); getAppletContext().showDocument(url); } catch (MalformedURLException e) { } } // This method is called whenever the page containing this applet is made // visible. public void start() {/** from N o w J a v a . c o m - 时代Java**/ } // This method is called whenever the page containing this applet is not // visible. public void stop() { } // This method is called once when the browser destroys this applet.