Is it possible to make only a certain portion of a JTextArea uneditable? i.e. the rest of the textarea remains editable except a particular portion? Thanks.
Printable View
Is it possible to make only a certain portion of a JTextArea uneditable? i.e. the rest of the textarea remains editable except a particular portion? Thanks.
Yes, but it requires a bit of work.
See this article for an example where I made the first section of a JTextArea un-editable: http://www.javaprogrammingforums.com...component.html. Note that this isn't the only focus of that article, but if you scroll down to the section about Document Filters that will have what you want. Also, you'll need to do something about undo/redo. The simple answer is to disable undo/redo for your text area, but I think it's possible to filter out certain changes from being added to the undo/redo list.