Le problemed'un JEditorPane

cs_chebil Messages postés 14 Date d'inscription vendredi 10 février 2006 Statut Membre Dernière intervention 6 février 2009 - 31 mars 2006 à 09:59
cs_chebil Messages postés 14 Date d'inscription vendredi 10 février 2006 Statut Membre Dernière intervention 6 février 2009 - 1 avril 2006 à 22:36
Bonjour
j'ai un probleme avec le JEditorPane:
je cherche a afficher la page html dont le code source est le suivant
//
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Essai : Connection à la caméra</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features)
{
window.open(theURL,winName,features);
}
//-->
</script>

</head>



<center>


320*240

<script language="JavaScript">if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform != "MacPPC")){
var resolution = "320*240";
if (resolution == "160*120")
{
document.write("<OBJECT ID='VAMCtrl' WIDTH=170 HEIGHT=150 CLASSID=CLSID:A93B47FD-9BF6-4DA8-97FC-9270B9D64A6C CODEBASE='http://192.168.0.99/plugin/h263ctrl.cab#version=1,7,0,24'>")}
if (resolution == "320*240")
{
document.write("<OBJECT ID='VAMCtrl' WIDTH=330 HEIGHT=270 CLASSID=CLSID:A93B47FD-9BF6-4DA8-97FC-9270B9D64A6C CODEBASE='http://192.168.0.99/plugin/h263ctrl.cab#version=1,7,0,24'>")}
if (resolution == "640*480")
{
document.write("<OBJECT ID='VAMCtrl' WIDTH=650 HEIGHT=510 CLASSID=CLSID:A93B47FD-9BF6-4DA8-97FC-9270B9D64A6C CODEBASE='http://192.168.0.99/plugin/h263ctrl.cab#version=1,7,0,24'>")}


document.write("")
document.write("")
document.write("")
document.write("")
document.write("")
document.write("")
document.write("")
document.write("")
document.write("</OBJECT>")} else document.write("Désolé, votre navigateur ne permet pas d'afficher la caméra !")</script>
</center>




</html>
//
et j'ai programme lecode source suivant en java pour afficher cette page


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import javax.swing.text.html.*;
import javax.swing.event.*;
public class Testeditor extends JFrame implements HyperlinkListener, ActionListener {


Testeditor(URL url) {
try {
this.setSize(1000, 1000);
JPanel urlPanel = new JPanel();
urlPanel.setLayout(new BorderLayout());
JEditorPane jep = new JEditorPane();
jep.setEditable(false);
jep.addHyperlinkListener (this);
jep.setPage(url);
JScrollPane jsp = new JScrollPane(jep);
urlPanel.add(jsp);
this.getContentPane().add(jsp, BorderLayout.CENTER);


}
catch (Exception e) {
System.out.println(e.toString());
}
}
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
JEditorPane pane = (JEditorPane) e.getSource();
if (e instanceof HTMLFrameHyperlinkEvent) {
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;
HTMLDocument doc = (HTMLDocument)pane.getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
} else {
try {
pane.setPage(e.getURL());
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
public void actionPerformed (ActionEvent event)
{


}
public static void main(String argv[]) {
try {
File f = new File("C:/Documents and Settings/administrateur/Bureau/camera3.html");
URL url = f.toURL();
Testeditor ted = new Testeditor(url);
ted.setVisible(true);
}
catch (Exception e) {
System.out.println(e.toString());
}


}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
le probleme est que dans le JEditorPane les lignes suivants sont affiches dans la page
Est ce que quelqu'un a une solution.
Merci d'avance
A voir également:

2 réponses

cs_mep Messages postés 86 Date d'inscription vendredi 7 mai 2004 Statut Membre Dernière intervention 3 septembre 2008 4
31 mars 2006 à 18:08
Essai de faire un monJEditorPane.setContentType("text/html");

mais je tiens a preciser que le editorPane affiche que du html stricte et donc pas de javascript ou autre balise farfelu...
0
cs_chebil Messages postés 14 Date d'inscription vendredi 10 février 2006 Statut Membre Dernière intervention 6 février 2009
1 avril 2006 à 22:36
Est ce qu'il ya un moyen d'afficher les fonctions javascript
0
Rejoignez-nous