How do I put html in a JLabel in java?

后端 未结 6 829
执笔经年
执笔经年 2020-12-03 22:05

How do I use html tags in a JLabel in java?

6条回答
  •  青春惊慌失措
    2020-12-03 22:15

    Also you can use this with all Swing buttons, menu items, labels, text panes, editor panes, tool tips, tabbed panes etc...

    JTextPane pane = new JTextPane();
    pane.setContentType("text/html");
    
    pane.setText("

    My First Heading

    My first paragraph.

    ");

提交回复
热议问题