Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
3004 connectés 

  FORUM HardWare.fr
  Programmation

  [JAVA] Interface Graphique et fichier HTML local

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[JAVA] Interface Graphique et fichier HTML local

n°138519
cezium
Posté le 14-05-2002 à 10:00:58  profilanswer
 

salut a tous
 
g kelke petit problème avec une interface graphique dont voici un bout de code:
JEditorPane jep=new JEditorPane(new URL("file://c:/resultat.htm" ));
 
quand j'écris cela, le fichiers htm ne s'affiche pas dans mon interface mais quand je met par exemple:
JEditorPane jep=new JEditorPane(new URL("http://www.exemple.com/test.htm" ));
ca fonctione, je ne comprends pas pourkoi celui avec le fichier local ne veut pas s'afficher dans l'interface.
 
 
g aussi un petit problème avec:
    JTabbedPane jtp=new JTabbedPane();
    jplog=new JPanel();
    jtp.add(jplog);
 
comment donner un nom a l'onglet qui va etre dans l'interface graphique au JPanel  jplog
 
merci d'avance

mood
Publicité
Posté le 14-05-2002 à 10:00:58  profilanswer
 

n°138526
darklord
You're welcome
Posté le 14-05-2002 à 10:12:36  profilanswer
 

c une applet?
 
Sinon tu n'as qu'à faire
 
try {
  JEditorPane jep = ....
}
catch (Exception e) {
  e.printStackTrace();
}
 
et tu verras déjà bcp plus clair  :heink:


---------------
Just because you feel good does not make you right
n°138527
benou
Posté le 14-05-2002 à 10:13:02  profilanswer
 

t'es sur que java.net.url gère le protocole "file://" ???
 
c'est quoi le message de l'exception que tu te manges ?


---------------
ma vie, mon oeuvre - HomePlayer
n°138530
darklord
You're welcome
Posté le 14-05-2002 à 10:14:33  profilanswer
 

benou >>> java.net.URL gère le protocole file


---------------
Just because you feel good does not make you right
n°138533
cezium
Posté le 14-05-2002 à 10:17:21  profilanswer
 

DarkLord > non, c pas un applet
 
Benou> c'est une IOException
 
au fait question con, quand je fais printStackTrace(), il écrit où le fichier avec les erreurs ?

n°138543
darklord
You're welcome
Posté le 14-05-2002 à 10:29:16  profilanswer
 

cezium a écrit a écrit :

DarkLord > non, c pas un applet
 
Benou> c'est une IOException
 
au fait question con, quand je fais printStackTrace(), il écrit où le fichier avec les erreurs ?  




 
la console. Envoie la trace de l'erreur dans un post


---------------
Just because you feel good does not make you right
n°138554
cezium
Posté le 14-05-2002 à 10:41:36  profilanswer
 

voila la trace de l'erreur avec cette commande:
JEditorPane jep=new JEditorPane(new URL("c:/resultat.htm" ));
 
 
java.net.UnknownHostException: c
 at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:81)
 at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:96)
 at javax.swing.JEditorPane.getStream(JEditorPane.java:569)
 at javax.swing.JEditorPane.setPage(JEditorPane.java:320)
 at javax.swing.JEditorPane.<init>(JEditorPane.java:180)
 at aspiweb.GUI.drawHtml(GUI.java:108)
 at aspiweb.GUI.main(GUI.java:187)
 at aspiweb.__SHELL9.run(__SHELL9.java:16)
 at bluej.runtime.ExecServer.suspendExecution(ExecServer.java:139)
 at bluej.runtime.ExecServer.main(ExecServer.java:69)

n°138565
darklord
You're welcome
Posté le 14-05-2002 à 10:55:31  profilanswer
 

ton URL est fausse déjà !!!
 
Commence par construre ton URL avant d'appeler ton constructeur avec !


---------------
Just because you feel good does not make you right
n°138574
cezium
Posté le 14-05-2002 à 11:12:26  profilanswer
 

toujours le meme problème
 
        URL testurl=new URL("file://C://listefilm.htm" );
        JEditorPane jep=new JEditorPane(testurl);
 
 
java.net.UnknownHostException: C
 at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:81)
 at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:96)
 at javax.swing.JEditorPane.getStream(JEditorPane.java:569)
 at javax.swing.JEditorPane.setPage(JEditorPane.java:320)
 at javax.swing.JEditorPane.<init>(JEditorPane.java:180)
 at aspiweb.GUI.drawHtml(GUI.java:109)
 at aspiweb.GUI.main(GUI.java:188)
 at aspiweb.__SHELL12.run(__SHELL12.java:16)
 at bluej.runtime.ExecServer.suspendExecution(ExecServer.java:139)
 at bluej.runtime.ExecServer.main(ExecServer.java:69)

n°138579
darklord
You're welcome
Posté le 14-05-2002 à 11:25:18  profilanswer
 

Il essaie de prendre la page par FTP. J'ai jamais eu ce problème. N'oublie pas que JEditorPane est seulement compatible  HTML 3.2
 
http://developer.java.sun.com/deve [...] rchive/29/


---------------
Just because you feel good does not make you right
mood
Publicité
Posté le 14-05-2002 à 11:25:18  profilanswer
 

n°138584
cezium
Posté le 14-05-2002 à 11:28:39  profilanswer
 

DarkLord a écrit a écrit :

Il essaie de prendre la page par FTP. J'ai jamais eu ce problème. N'oublie pas que JEditorPane est seulement compatible  HTML 3.2
 
http://developer.java.sun.com/deve [...] rchive/29/  




 
ok, en fait le fichier html que j'essaye d'afficher , c 'est un fichier que je crée, y'a un moyen de le creer pour qu'il soit compatibe avec html v3.2 ?

n°138593
cezium
Posté le 14-05-2002 à 12:38:47  profilanswer
 

c bon ca marche suffisait de mettre ca
 
JEditorPane jep=new JEditorPane(new URL("file:/c:/resultat.htm" ));  
 
ya'avais un / en trop
 
 :bounce:  :bounce:  :)


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation

  [JAVA] Interface Graphique et fichier HTML local

 

Sujets relatifs
[HTML] 1 Formulaire - 2 directions differentes[Java] Boutton
[MYSQL] Ou se trouve le fichier my.cnf ....???[HTML] Lien de fichier pour telechargement et non en ouverture
[HTML] interaction entre une fenêtre de l'explorateur et une popupjava : question sur "synchronized"
[Java Unix] non-static method cannot be referenced from a static ...de l'html (gras italique etc..) dans un formulaire...
[HTML] BODY, ya une bordure moche à droite, comment la virer ??? 
Plus de sujets relatifs à : [JAVA] Interface Graphique et fichier HTML local


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR