How do you open web pages in Java?

后端 未结 6 1485
庸人自扰
庸人自扰 2021-02-13 04:19

Is there a simple way to open a web page within a GUI\'s JPanel?

If not, how do you open a web page with the computer\'s default web browser?

I am hoping for so

6条回答
  •  不知归路
    2021-02-13 04:44

    If you're developing an applet, you can use AppletContext.showDocument. That would be a one-liner:

    getAppletContext().showDocument("http://example.com", "_blank");
    

    If you're developing a desktop application, you might try Bare Bones Browser Launch.

提交回复
热议问题