For some time I created something like a text editor and noticed one interesting function in NetBeans: when creating a Java application from a template (for example, "Desktop Application") it creates immutable blocks of code (they are present for viewing, but they cannot be changed directly).
This snapshot should make the whole text above understandable:

So, the question is: how to implement such a function using JTextPane?
source
share