Java Example Program/ Sample Source Code
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.awt.event.*;
public class ShowDocument_AppletContext1 {
public void init() {
Button button = new Button("Go To Html Page");
button.addActionListener(this);
add(button);
}
public void actionPerformed(ActionEvent ae) {
try {
URL url = new URL(getDocumentBase(), "HtmlExample.html");
getAppletContext().showDocument(url);
} catch (MalformedURLException e) {
showStatus("URL not found");
}
}
} |
|
|