how to insert or append new line on top of the jtextarea in java swing ? i want to to append jtextarea and add the new line on top of the jtextarea please help me how to do this.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Your best option is to directly modify the underlying
Document
of theJTextArea
.Here is a small demonstration of this:
You can do this:
Or, an even better solution would be this:
textArea.setText("this is new line" + "\n" + textArea.getText())