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

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

I want to do something really simple like this:

JPanel htmlPanel = new HtmlPanel(\"

hello world

4条回答
  •  猫巷女王i
    2021-01-01 02:34

    In case anyone is still looking for an easy solution to just enable display of HTML-Markup: Use a JLabel and enclose the text in '' and '' (body tag isn't needed).

    Have a look at How to Use HTML in Swing Components. I just came across this when looking for an easy way to display data in tables, and it works like a charm.

提交回复
热议问题