How to render basic HTML markup inside a JPanel in Java Swing?

后端 未结 4 1283
日久生厌
日久生厌 2021-01-01 02:09

I want to do something really simple like this:

JPanel htmlPanel = new HtmlPanel(\"

hello world

4条回答
  •  忘掉有多难
    2021-01-01 02:43

    Check here to see how to add CSS support to your JEditorPane. You will need an HTMLEditorKit.

    I do not see why you would need JavaScript support for a JEditorPane. The basic use of it is to render Help pages written in HTML and CSS.

    If you need to have the real McCoy embedded into your application, try the Lobo Java Web Browser. Lobo does JavaScript and CSS and is open source 100% Java.

    November 2015: The latest fork of the Lobo Browser is Lobo Evolution.

提交回复
热议问题