/Users/lyon/j4p/src/gui/html/Browser.java
|
1 package gui.html;
2
3 import net.proxy.Proxy;
4
5 /**
6 * Browser is a better browser.
7 * It knows how to follow link clicks!
8 */
9
10 public class Browser extends gui.ClosableJFrame {
11 private javax.swing.JEditorPane htmlPane =
12 new javax.swing.JEditorPane();
13
14 public Browser() {
15 super("HtmlViewer");
16 Proxy.setSoeProxy();
17 java.awt.Container c = getContentPane();
18 c.setLayout(new java.awt.GridLayout(1, 0));
19 c.add(new javax.swing.JScrollPane(htmlPane));
20 htmlPane.setEditable(false);
21 setSize(400, 400);
22 setVisible(true);
23 htmlPane.addHyperlinkListener(new BrowserListener());
24 }
25
26 public void setHtml(String s) {
27 htmlPane.setContentType("text/html");
28 htmlPane.setText(s);
29 }
30
31 public void setString(String s) {
32 setHtml(s);
33 System.out.println(s);
34 }
35
36 public static void main(String args[]) {
37 Browser b = new Browser();
38 HtmlSynthesizer hs = new HtmlSynthesizer();
39 b.setString(hs.testForm());
40 }
41 }