FileDocCategorySizeDatePackage
ShowDocApplet.javaAPI DocExample974Mon Apr 17 17:00:42 BST 2000None

ShowDocApplet

public class ShowDocApplet extends Applet
ShowDocApplet: Demonstrate showDocument().
author
Ian Darwin, ian@darwinsys.com

Fields Summary
String
targetString
URL
targetURL
The URL to go to
Constructors Summary
Methods Summary
public voidinit()
Initialize the Applet


	    
	   
		setBackground(Color.gray);
		try {
			targetURL = new URL(targetString);
		} catch (MalformedURLException mfu) {
			throw new IllegalArgumentException(
				"ShowDocApplet got bad URL " + targetString);
		}
		Button b = new Button("View Secret");
		add(b);
		b.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getAppletContext().showDocument(targetURL);
			}
		});
	
public voidstop()

		System.out.println("Ack! Its been fun being an Applet. Goodbye!");