ADESH RAJPUT
ADESH RAJPUT

Reputation: 131

browse HTML File in Swing form

I am working in Swing in Java and i want to display the HTML page as it is in Swing Form , Is there any tool to display or show the HTML file the file may have links and on clicking on those links other files should be displayed . In simple word i want any control like browser to browse in Swing form . Is it possible please help me I dont know the code for it

thanks in advance

Upvotes: 0

Views: 1172

Answers (3)

radkovo
radkovo

Reputation: 888

SwingBox provides a Swing component for displaying HTML documents. It supports more from CSS than the standard JEditorPane. A demo is included in the package.

Upvotes: 1

Alix Martin
Alix Martin

Reputation: 332

Most Swing components can include html formatting, but to get the link behaviour right, they need to instance a HyperlinkListener, which are applicable to JEditorPane

http://docs.oracle.com/javase/7/docs/api/javax/swing/event/class-use/HyperlinkListener.html

Upvotes: 0

Reimeus
Reimeus

Reputation: 159754

You could use JEditorPane:

String url = "http://host/path";
JEditorPane htmlPane = new JEditorPane(url);
htmlPane.setContentType("text/html");

Upvotes: 3

Related Questions