Programación General > Java
Jeditorpane + Html + Javascript
(1/1)
Tisus:
Hola a todos. Tengo un pequeño problema.
Tengo en una pagina html embebido un codigo JavaScript. Cuando lo subo al JEditoPane se me pierden unos botones. Quisero saber como puedo sin perder las caracteristicas de mi html al JEditoPane. El codigo que estoy utilizando es el siguiente:
--- Código: Text --- 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 ); } }
Navegación
Ir a la versión completa