IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

[HTML] Comment afficher une aide html & créer un jar // JDIC


Sujet :

AWT/Swing Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    340
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 340
    Par défaut [HTML] Comment afficher une aide html & créer un jar // JDIC
    Voila, j'ai mon fichier d'aide en html. Mais vu les contraintes liées au Desktop.open(), je cherche à me rabattre sur un affichage de mon aide dans un composant. En cherchant, j'ai cru comprendre qu'il fallait utiliser un JEditorPane (ou un JTextPane) et un HTMLEditorKit.
    De là, je dois faire un truc du genre :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    t = new JEditorPane();
    t.setEditorKit(new HTMLEditorKit());
    mais comment charger mon fichier html dans le composant?

  2. #2
    Expert confirmé
    Avatar de Baptiste Wicht
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2005
    Messages
    7 431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2005
    Messages : 7 431
    Par défaut
    Tu peux utiliser la méthode setPage(URL url) avec un URL pointant vers ton fichier HTML.

    Fais juste attention au fait que l'affichage HTML reste assez limitée. Si tu veux vraiment quelque chose de très complet, il te faudra t'orienter vers le webbrowser de JDIC.

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    340
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 340
    Par défaut
    Comment utilise t on le WebBrowser?
    j'ai bien essayé de faire new WebBrowser(getClass().getResource("monaide.htm")); mais il ne s'est rien passé...

  4. #4
    Expert confirmé
    Avatar de Baptiste Wicht
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2005
    Messages
    7 431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2005
    Messages : 7 431
    Par défaut
    Citation Envoyé par michaeljeru
    Comment utilise t on le WebBrowser?
    j'ai bien essayé de faire new WebBrowser(getClass().getResource("monaide.htm")); mais il ne s'est rien passé...
    Qu'entends-tu par "il ne s'est rien passé" ? Tu as juste fait un new WebBrowser ? Le WebBrowser est un composant AWT, il faut donc l'ajouter à quelque chose. Tu l'as ajouté à un container ? Montre un peu ton code.

  5. #5
    Membre éclairé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    340
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 340
    Par défaut
    Ok, je pensais pas que c'était un composant graphique, donc qu'il fallait l'insérer... je faisais juste new WebBrowser(url)

    voici mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    if(o.equals(afficheraide)){
    				JFrame web=new JFrame("Aide");
    				WebBrowser b=new WebBrowser(getClass().getResource("C:\\Documents and Settings\\PC MiKL\\workspace\\Evolution\\aide\\aide.htm"));
    				JPanel panweb=new JPanel(new FlowLayout());
    				panweb.add(b);
    			}
    à l'heure actuelle, il m'affiche toujours la même erreur liée au JDIC :
    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no jdic in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.jdesktop.jdic.browser.internal.WebBrowserUtil.<clinit>(Unknown Source)
    at org.jdesktop.jdic.browser.MsgClient.<init>(Unknown Source)
    at org.jdesktop.jdic.browser.NativeEventThread.<init>(Unknown Source)
    at org.jdesktop.jdic.browser.WebBrowser.<clinit>(Unknown Source)
    at evolution.Interface.actionPerformed(Interface.java:2373)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

  6. #6
    Membre éclairé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    340
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 340
    Par défaut
    bon, j'ai réussi à me débarasser du message d'erreur, mais maintenant, qd je clique sur afficher l'aide, je vois bien qu'il se passe qqch avec le jdic, pcq zone alarm me demande d'accepter Java Integration Components, ce que je fais.
    Mais après, ma frame s'affiche bien, mais vide. Il n'y a rien dedans. pas de webBrowser...

    edit : au passage,
    Desktop.browse(new URL("C:\\Documents and Settigs\\PC MiKL\\workspace\\Evolution\\aide\\aide.htm"));

    et

    Desktop.open(new File("C:\\Documents and Settigs\\PC MiKL\\workspace\\Evolution\\aide\\aide.htm"));

    sont sans effets non plus...

Discussions similaires

  1. Réponses: 5
    Dernier message: 09/07/2008, 11h26
  2. [HTML] Comment afficher une image dans un mail?
    Par NedaRyme dans le forum Balisage (X)HTML et validation W3C
    Réponses: 6
    Dernier message: 14/02/2008, 13h20
  3. comment afficher une page html dans jsf ?
    Par Philcmoi dans le forum JSF
    Réponses: 1
    Dernier message: 01/10/2007, 11h47
  4. comment afficher une page html dans internet
    Par Philcmoi dans le forum Intégration
    Réponses: 1
    Dernier message: 28/09/2007, 07h25
  5. [web] comment afficher une page html
    Par ciel65 dans le forum Web
    Réponses: 4
    Dernier message: 10/11/2006, 11h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo