How to display an html page in a Jtextpane?

Asked

Viewed 370 times

4

People I’m trying to display/integrate a php page into a JtextPane, works but I have no control of HTML, it just displays the text that the page generates and I would like to display with HTML, <div>, CSS, but I’m not getting any suggestions ?

Follows 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);

1 answer

1

Maybe I need to set the content type of Jtextpane like this:

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

Reference of the complete answer : link

Browser other questions tagged

You are not signed in. Login or sign up in order to post.