tags:

views:

253

answers:

6

What libraries/methods that you know of can do some basic HTML representation in Swing? Can you comment on your experience?

+1  A: 

I haven't tried this in a while, but a quick google search shows some possibilities:

Are you trying to do this in an applet, or an application? If it's an application (or signed applet) you could potentially instantiate IE or Firefox within your application. Webrenderer acts as a Swing wrapper for this.

Herms
+1  A: 

Swing has a built-in compontent called BasicHTML. I've never used it, but I think it should be sufficient for the basic stuff.

david
+1  A: 

Many of the Swing controls (like JLabel) can render basic HTML content. JEditorPane can be used to display HTML pages. However, these controls are limited to HTML 3.2 support.

For a richer experience, I would use the JDesktop Integration Components.

JDIC provides Java applications with access to functionalities and facilities provided by the native desktop. It consists of a collection of Java packages and tools. JDIC supports a variety of features such as embedding the native browser, launching the desktop applications, creating tray icons on the desktop, registering file type associations, creating JNLP installer packages, etc.

McDowell
A: 

This has historically been a major weak point for Java, IMO. There are numerous ways to display limited markup, but very few that offer full featured HTML capabilities. The previously mentioned JDIC component is one option, however it is considered a "heavyweight" component and therefore does not always integrate well with Swing applications.

I am hopeful, however, that the new Webkit based JWebPane project will provide more advanced capabilities without all of the issues that we've had to deal with in the past. And, of course, there are several commercial options as well (IceBrowser is pretty good as an example).

jsight
A: 

Came across Lobo java web browser the other day.

Lobo is being actively developed with the aim to fully support HTML 4, Javascript and CSS2.

No experience with it though, but thought it may fit the bill for you.

Evan
+1  A: 

A good pure Java solution is JWebEngine. It render HTML 4 very good.

Horcrux7