Bonjour,
J'affiche une page web dans un jEditorPane (code exemple récupéré sur internet).
La page ne s'affiche pas du tout comme sur un navigateur web quelconque : pas de photos, champs décalés, ...
Quelqu'un peut-il m'aider ?
Voici le code :
import java.io.*;
public class Test extends JFrame
{
public static void main(String arg[])throws Exception
{
new Test();
}
public Test() throws Exception
{
String s = "http://www.google.fr";
JEditorPane pane = new JEditorPane(s);;
pane.setEditable(false);
final JEditorPane finalpane = pane;
pane.addHyperlinkListener(new HyperlinkListener()
{
public void hyperlinkUpdate(HyperlinkEvent r)
{
try
{
if(r.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
finalpane.setPage(r.getURL());
}catch(Exception e)
{}
}
});
setContentPane(new JScrollPane(pane));
setSize(400,400);
setVisible(true);
}
}
Partager