How to display an html page in a JTextPane?

4

I'm trying to display / embed a php page in a JtextPane , it works but I do not have HTML control, it only displays the text that the page generates and I'd like to display it with HTML, <div> , CSS , but I'm not getting any suggestions?

Follow the code:

JScrollPane js = new JScrollPane();
JTextPane txtpnDescricaomsg = new JTextPane(); 
txtpnDescricaomsg.setText(descricao);
txtpnDescricaomsg.setFont(new Font("Tahoma", Font.BOLD, 16));
js.setViewportView(txtpnDescricaomsg);
js.setBounds(16, 401, 801,220);
getContentPane().add(js);
    
asked by anonymous 11.06.2015 / 22:37

1 answer

1

You may need to set the JTextPane content type like this:

JTextPane painel = new JTextPane();
painel.setContentType("text/html");

Full Response Reference: link

    
17.06.2015 / 15:26