• Sábado 21 de Septiembre de 2024, 14:30

Autor Tema:  Jeditorpane + Html + Javascript  (Leído 1565 veces)

Tisus

  • Miembro activo
  • **
  • Mensajes: 52
    • Ver Perfil
Jeditorpane + Html + Javascript
« en: Jueves 8 de Diciembre de 2005, 18:07 »
0
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
  1.  
  2. public Html(String url)  throws IOException {
  3.     super(url);
  4.       try{
  5.         this.setContentType("text/html");
  6.             this.setPage(getClass().getResource(url));
  7.             this.setEditable(true);
  8.             this.addHyperlinkListener( this );
  9.       }catch(Exception e){
  10.        
  11.       }
  12.   }
  13.  
  14.   public Html(){
  15.    
  16.   }
  17.  
  18.   public void setHtml(String url)  throws IOException {
  19.     try{
  20.         this.setContentType("text/html");
  21.             this.setPage(getClass().getResource(url));
  22.             this.setEditable(false);
  23.             this.addHyperlinkListener( this );
  24.       }catch(Exception e){
  25.        
  26.       }
  27.   }
  28.  
  29.   public void hyperlinkUpdate(HyperlinkEvent evento) {
  30.     // TODO Auto-generated method stub
  31.     if( evento.getEventType() == HyperlinkEvent.EventType.ACTIVATED ){
  32.       // Load some cursors
  33.       waitCursor = Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR );
  34.       this.setCursor( waitCursor );
  35.       JEditorPane pane = (JEditorPane) evento.getSource();
  36.       if( evento instanceof HTMLFrameHyperlinkEvent ){
  37.         HTMLFrameHyperlinkEvent  evt = (HTMLFrameHyperlinkEvent)evento;
  38.         HTMLDocument doc = (HTMLDocument)pane.getDocument();
  39.         doc.processHTMLFrameHyperlinkEvent(evt);
  40.       }
  41.       else{
  42.         try {
  43.           pane.setPage(evento.getURL());
  44.         }
  45.         catch(Throwable t ){
  46.           t.printStackTrace();
  47.         }
  48.       }
  49.       // Restore the cursor
  50.       this.setCursor( waitCursor );
  51.     }
  52.   }
  53.  
  54.