setSize( 350, 450 );
setTitle( "Scrolling Browser" );
addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e )
{ System.exit( 0 );
}
});
try
{ url = new URL( site );
}
catch( MalformedURLException e )
{ System.out.println( "Invalid URL specified" );
System.exit( 0 );
}
try
{ html = new JEditorPane( url );
}
catch( IOException e )
{ System.out.println( "Can't load url: " + url );
System.exit( 0 );
}
JScrollPane scroller = new JScrollPane();
JViewport viewport = scroller.getViewport();
viewport.add( html );
getContentPane().add( scroller );
html.setEditable( false ); // to allow links to be activated
html.addHyperlinkListener( this );
setVisible( true );