How to add text to a textArea instead of replacing it

前端 未结 3 1967
温柔的废话
温柔的废话 2021-02-07 16:49

How can I add text to a JTextArea instead of replacing all of it?

I know about setText(String) but other than that I\'m a bit lost.

3条回答
  •  醉酒成梦
    2021-02-07 17:19

    void append(JTextArea area, String newText){
            area.setText(area.getText() + newText)
    }
    

提交回复
热议问题