Color Not Applied In JTextPane If Disabled

So I had a JTextPane that displays text in HTML format. The color issue arises when I disable the JTextPane. A workaround to this is to use the setEditable() method instead of setEnabled().

Then again, another issue arises. You will be able to select the text even though you cannot insert or remove characters in the JTextPane. If you do not want the JTextPane to have a selection feature if it is not editable, then only way to make it work is to override its protected method processMouseEvent().

This should do the trick.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *