Plain.java
// package nov25.browser;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;

public class Plain extends Object {
    
    public Plain() {
        JFrame main = new JFrame("A Plain Browser");
        main.setSize(600, 400);
        main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = main.getContentPane();
        Box addr = Box.createHorizontalBox();
        addr.add(new JLabel("Address:"));
        final JTextField addrfield = new JTextField("http://www.yahoo.com/");
        addr.add(addrfield);
        content.add(BorderLayout.NORTH, addr);
        final JEditorPane browser = new JEditorPane();
        browser.setEditable(false);
        try {
            URL src = new URL(addrfield.getText());
            browser.setPage(src);
        } catch (java.net.MalformedURLException mf) {
            browser.setText("Bad url!");
        } catch (java.io.IOException io) {
                browser.setText("IO error!");
        }
        JScrollPane scroller = new JScrollPane();
        scroller.getViewport().add(browser);
        content.add(BorderLayout.CENTER, scroller);
        final JTextField statusbar = new JTextField();
        statusbar.setEditable(false);
        content.add(BorderLayout.SOUTH, statusbar);
        
        addrfield.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                try {
                    URL src = new URL(addrfield.getText());
                    browser.setPage(src);
                } catch (java.net.MalformedURLException mf) {
                    browser.setText("Bad url!");
                } catch (java.io.IOException io) {
                    browser.setText("IO error!");
                }
            }
        });

        browser.addHyperlinkListener(new HyperlinkListener() {
            public void hyperlinkUpdate(HyperlinkEvent he) {
                if(he.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                    try {
                        browser.setPage(he.getURL());
                        addrfield.setText(he.getURL().toString());
                    } catch (java.net.MalformedURLException mf) {
                        browser.setText("Bad url!");
                    } catch (java.io.IOException io) {
                        browser.setText("IO error!");
                    }
                } else if(he.getEventType() == HyperlinkEvent.EventType.ENTERED) {
                    statusbar.setText(he.getURL().toString());
                }
            }
        });
        
        main.show();
    }

    /**
    * @param args the command line arguments
    */
    public static void main (String args[]) {
        new Plain();
    }

}

syntax highlighted by Code2HTML, v. 0.9-jb1