I've been creating something like text editor for a while and noticed one interesting feature in NetBeans: when creating Java Application from a template (for example, "Desktop Application"), it creates immutable blocks of code (they are present for viewing but they can not be modified directly).
This shot should make all that text above clear:
So, the question is: how to implement such a feature using JTextPane?
You must create a class implementing the javax.swing.text.DocumentFilter used by your editor pane for the unchanged text. For the highlighting I suppose you will have to use a javax.swing.text.Highlighter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With