1

I am trying to put an offline Openstreetmap map into my Java Application. I have found an example here: http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JEditorPane.html

However when I tried to change the URL in the program to the file that is in my computer, it did not work. The HTML page that I am trying to display has JavaScript and I think this is why it will not appear. (I tried displaying a different HTML which was more simple and only had an image to display and it worked.)

Is there a way to embed an HTML file in a Java Application that supports JavaScript? Or is something else preventing the application from displaying my HTML file?

edit: I am trying to embed an HTML file with an OpenLayers Javascript. I have come across the Lobo Browser, it seems like what I am looking for. However when I try to visit a site in the browser, it only show's me a blank page. I am sure that my Java is updated. Has anyone had experience with the Lobo Browser and have an idea as to why it is not working for me?

5 Answers 5

1

Is there a way to embed an HTML file in a Java Application that supports JavaScript?

Possibly by embedding support for the the Rhino engine or the ScriptEngine into the HTMLEditorKit.

Note that I have considered trying to do that myself, but since it seems like a lot of effort for little chance of success, I always avoided doing so.

Sign up to request clarification or add additional context in comments.

Comments

1

As per this reply:

JEditorPane has limited html and css support. It does not support javascript or applets.

An alternate solution suggested is trying to embed Gecko in your application.

Comments

1

You can try JavaFX. I found some nice alternatives that I'm willing to try here:

Comments

0

I suppose that shouldnot be a problem. It wud be helpful if you could paste the code in that file you are pointing to(the one containing javascript that you suspect is not working).

Comments

0

I have found this similar question: Embed a web browser within a java application

There are many different answers there. Mozswing worked for me: http://sourceforge.net/projects/mozswing/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.