Interface Graphique et fichier HTML local [JAVA] - Programmation
Marsh Posté le 14-05-2002 à 10:12:36
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  
 
Marsh Posté le 14-05-2002 à 10:13:02
t'es sur que java.net.url gère le protocole "file://" ??? 
 
c'est quoi le message de l'exception que tu te manges ? 
Marsh Posté le 14-05-2002 à 10:14:33
benou >>> java.net.URL gère le protocole file
Marsh Posté le 14-05-2002 à 10:17:21
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 ? 
Marsh Posté le 14-05-2002 à 10:29:16
| 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 
Marsh Posté le 14-05-2002 à 10:41:36
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) 
Marsh Posté le 14-05-2002 à 10:55:31
ton URL est fausse déjà !!! 
 
Commence par construre ton URL avant d'appeler ton constructeur avec ! 
Marsh Posté le 14-05-2002 à 11:12:26
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) 
Marsh Posté le 14-05-2002 à 11:25:18
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/ 
Marsh Posté le 14-05-2002 à 11:28:39
| 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 ? 
Marsh Posté le 14-05-2002 à 12:38:47
c bon ca marche suffisait de mettre ca 
 
JEditorPane jep=new JEditorPane(new URL("file
c
resultat.htm" ));  
 
ya'avais un / en trop 
 
 
  
  
 
Marsh Posté le 14-05-2002 à 10:00:58
salut a tous
resultat.htm" )); 
g kelke petit problème avec une interface graphique dont voici un bout de code:
JEditorPane jep=new JEditorPane(new URL("file://c
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