How can you display a particular web page from an applet?
The following code snippet shows you how to achieve that using showPage method is capable of displaying any URL passed to it.
import java.net.*;
import java.awt.*;
import java.applet.*;
public class TestApplet extends Applet
{
// Applet code goes here
// Show a page
public void showPage ( String showPage)
{
URL url = null;
// Create a URL object
try
{
url = new URL ( showPage );
}
catch (MalformedURLException e)
{
// Invalid URL
}
// Show URL
if (url != null)
{
getAppletContext().showDocument (url);
}
}
}