setSize( 350, 450 );
setTitle( "Scrolling Browser" );
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( new JLabel( "URL:" ) );
topLine.add( location );
location.addActionListener( this );
// for the JFrame:
this.getContentPane().setLayout( new BorderLayout() );
this.getContentPane().add( topLine, BorderLayout.NORTH );
/**/ bottomLine = new JLabel( "" );
/**/ this.getContentPane().add( bottomLine, 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 );