public Html(String url) throws IOException {
super(url);
try{
this.setContentType("text/html");
this.setPage(getClass().getResource(url));
this.setEditable(true);
this.addHyperlinkListener( this );
}catch(Exception e){
}
}
public Html(){
}
public void setHtml(String url) throws IOException {
try{
this.setContentType("text/html");
this.setPage(getClass().getResource(url));
this.setEditable(false);
this.addHyperlinkListener( this );
}catch(Exception e){
}
}
public void hyperlinkUpdate(HyperlinkEvent evento) {
// TODO Auto-generated method stub
if( evento.getEventType() == HyperlinkEvent.EventType.ACTIVATED ){
// Load some cursors
waitCursor = Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR );
this.setCursor( waitCursor );
JEditorPane pane = (JEditorPane) evento.getSource();
if( evento instanceof HTMLFrameHyperlinkEvent ){
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)evento;
HTMLDocument doc = (HTMLDocument)pane.getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
}
else{
try {
pane.setPage(evento.getURL());
}
catch(Throwable t ){
t.printStackTrace();
}
}
// Restore the cursor
this.setCursor( waitCursor );
}
}