Make parts of a JTextArea non editable (not the whole JTextArea!)
问题 I'm currently working on a console window in Swing. It's based on a JTextArea and works like a common command line. You type a command in one line and press enter. In the next line, the output is shown and under that output, you could write the next command. Now I want, that you could only edit the current line with your command. All lines above (old commands and results) should be non editable. How can I do this? 回答1: You do not need to create your own component. This can be done (as in I