Appending text in Java's JTextArea

后端 未结 3 1970
梦如初夏
梦如初夏 2020-12-21 01:34

I have a problem with my text area.

I use jTextArea1.append(\"cleverly amusing\"); to add the text..

FIRST APPEND:

3条回答
  •  清酒与你
    2020-12-21 02:27

    If your JTextArea will only contain "WORD HINT: ..." then use the setText() method:

    jTextArea1.setText("WORD HINT:\n" + word);
    

    This will replace all the text with what you want.

    BTW : removeAll() is part of the Container class, and is not to remove text but child components.

提交回复
热议问题