0

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

ADESH RAJPUT
  • 131
  • 1
  • 5
  • 10

3 Answers3

3

You could use JEditorPane:

String url = "http://host/path";
JEditorPane htmlPane = new JEditorPane(url);
htmlPane.setContentType("text/html");
Reimeus
  • 158,255
  • 15
  • 216
  • 276
1

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.

radkovo
  • 868
  • 6
  • 10
0

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

Alix Martin
  • 332
  • 1
  • 5