FileDocCategorySizeDatePackage
Browser1.javaAPI DocExample1722Sat Nov 25 12:54:06 GMT 2000None

Browser1

public class Browser1 extends Object
Browser1 - Get the contents of a URL, write to stdout

Fields Summary
JEditorPane
p
Constructors Summary
Browser1(String[] av)

		String loc = null;
		String data = null;
		switch(av.length) {
			case 0: loc = "http://localhost/"; break;
			case 1: loc = av[0]; break;
			default:
				System.err.println("Usage: getFromURL [url]");
				System.exit(1);
		}
		try {
			URL Web = new URL(loc);
			p = new JEditorPane(Web);
			JFrame jf = new JFrame("HTML");
			p.setContentType("text/html");
			p.addHyperlinkListener(new Hyperactive());
			p.setEditable(false);
			Container cp = jf.getContentPane();
			cp.add(BorderLayout.NORTH, p);
			jf.pack();
			jf.setVisible(true);
		} catch (MalformedURLException e) {
			System.out.println("MalformedURLException: " + e);
		} catch (IOException e) {
			System.out.println("IOException: " + e);
		}
		if (data != null)
			System.out.println("Data " + data);
	
Methods Summary
public static voidmain(java.lang.String[] av)

		new Browser1(av);