Reputation: 131
I have to make a Web Browser, displaying the web pages from a DOM tree. I have the DOM tree done using jsoup library, but I don't know how to display the web page on a JEditorPane.
I have this:
Document domTree = BackEnd.getInstance().getDOM(linkBar.getText(), "GET", null);
which makes a Document (domTree), as a HTML document, that has the DOM tree of the web site entered in the link bar. How can I use this document to display the web page on that JEditorPane? Or do I have to use a different thing than JEditorPane?
Upvotes: 0
Views: 766
Reputation: 8509
Usually JEditorPane is used to render HTML in Java swing. You just need to set the content type. Since you have the document object ready try
editor.setContentType( "text/html" );
editor.setText( domTree.html() );
Upvotes: 1