The text is not messed up, it's just using a non-monospaced font so not all characters have the same width.
Just do this to your TextArea:
textArea.setFont(new Font("Courier New", Font.PLAIN, 12));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.