Java Open URL Inside of a JFrame

2019-08-28 09:25发布

问题:

I was wondering if there is a way to open a URL inside of a JFrame or JDialog. I need this to protect the URL.

Is there a way to run a browser inside of a Java component such as a JFrame or a JDialog?

回答1:

This should be what you are looking for, a web browser component that you can easily use in your SWING application



回答2:

This would only make the URL secret for dummies. With a network sniffer like Ethereal, it would be trivial to know which requests are made by your application. Security through obscurity is always a bad idea.

If you want to do that for other reasons, JEditorPane is able to display HTML and load it from a URL, but its HTML capabilities are very limited compared to a real browser.