setSize( 550, 450 );
setTitle( "Simple Web Browser #4" );
addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e )
{ System.exit( 0 );
}
});
// Build more interesting interface
location = new JTextField( site, 25 ); // 25 cols
JPanel topLine = new JPanel();
topLine.setLayout( new FlowLayout( FlowLayout.LEFT ) );
topLine.add( back );
topLine.add( forward );
topLine.add( new JLabel( "URL:" ) );
topLine.add( location );
location.addActionListener( this );
back.addActionListener( this );
forward.addActionListener( this );
// for the JFrame:
this.getContentPane().setLayout( new BorderLayout() );
this.getContentPane().add( topLine, BorderLayout.NORTH );
this.getContentPane().add( statusLine, BorderLayout.SOUTH );
if( !site.equals( "NoURL" ) )
{ loadURL( site );
}
JScrollPane scroller = new JScrollPane();
JViewport viewport = scroller.getViewport();
viewport.add( html );
this.getContentPane().add( scroller, BorderLayout.CENTER );
html.setEditable( false ); // to allow links to be activated
html.addHyperlinkListener( this );
setVisible( true );