Append text in JLabel

前端 未结 2 1293
囚心锁ツ
囚心锁ツ 2020-12-11 09:19

How would I go about achieving the effect of JTextArea with JLabel?

I want the output to be displayed every time the button is clicked on the next line down instead

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-11 09:33

    1. Use HTML formatting in the label by starting the text with prefix (possibly add some in-line styles in the body opening element).
    2. Add each line, ending with
      or

      (or

    3. if adding
      • to the prefix).

    See also How to Use HTML in Swing Components. For such gems as..

    HTML Button

提交回复
热议问题