views:

556

answers:

5

Does anybody know of a pure java (ar at least cross platform) open source component/library which displays HTML which can contain swing components inside it?

All I could find were either abandoned or incomplete.

I am asking because I'm thinking about trying out approach to do use this combination for creating desktop application.

EDIT:Seems like this question is missunderstood, so let me clarify it. I basically want to create desktop application in the similar way as web. Idealy I would like browser to serve as an UI layer. That browser should allow me to embed my own compoents, eg to be able to use JTextField instead of <input type="text">.

Since I don't know of such easily usable browser, I was asking for a html component which will let me do it. I hop the question is clearer right now.

+2  A: 

I think the question is the other way around or, better, goes further than using JTextPane. As I understand the question: Marko needs a Java component that can display HTML and additionally is able to contain further Swing components. Say, there should be a new tag

<swing jclass="MySwingComponent" />

which would render that MySwingComponent class. Not sure, maybe it would also be okay to have a HTML-able Swing component that can embed further applets?

And no, I don't know of such a thing. Sorry.

kenoa
+1  A: 

JavaFX maybe?

willcodejavaforfood
A: 

I thought Google Web Toolkit allowed you to write a UI in terms of Java/Swing. It would then convert it to JavaScript. Maybe that's what you're looking for.

duffymo
GWT is unrelated to Swing.
Tom
+2  A: 

JEditorPane already supports what you want to do. It can render HTML (pretty crappily, I'll admit) and you can embed Swing components in that HTML using the <object> tag. Here is a blog post that demonstrates this technique: http://weblogs.java.net/blog/aim/archive/2007/07/index.html

Otherwise, I don't think you have a lot of options.

Dave Ray
A: 

check out xhtmlrenderer: https://xhtmlrenderer.dev.java.net/

You will have to work wit it to get it to do all you want.

l_39217_l