Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed browser in Java based desktop application [duplicate]

Possible Duplicate:
Is there a way to embed a browser in Java?

How can I embed a browser in a Java based desktop application? Can I communicate with the embedded browser directly (not via localhost)... such as loading html text, capturing onclick events, getting form values?

Thanks

like image 328
jrhicks Avatar asked Sep 21 '09 13:09

jrhicks


3 Answers

check out Eclipse, it has an embedded browser which is configurable by the user (they support multiple browsers).

you can probably embed their browser even if you use an AWT based application using the AWT_SWT bridge.

this article may help you get started.

like image 151
Omry Yadan Avatar answered Nov 15 '22 21:11

Omry Yadan


Swing JEditor pane is able to display HTML.

Check http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JEditorPane.html

Also here in SO is a more detailed answer to this topic:

https://stackoverflow.com/questions/48249/java-embedding-a-web-browser-pane

like image 24
JuanZe Avatar answered Nov 15 '22 21:11

JuanZe


You can build a very primitive browser using JEditorPane. You can listen to Hyperlink events, but javascript or getting form values isn't possible.

like image 22
kgiannakakis Avatar answered Nov 15 '22 21:11

kgiannakakis