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);