I have created a java application in which JTextpane is used as an editor. Now my problem is that when I select a block of text and press tab key, it automatically deletes the selected text contents. I don't expect these behaviour for my tool's editor. I need to add indendation of selected text to my editor just like in notepad++. How can I resolve this problem? Can any one please help me.. I am not able to resolve it.. Please help.. Thanks in advance...

7 Years
Discussion Span
Last Post by mKorbel

I don't know about notepad++, but the behaviour you describe (type a tab and it replaces the currently-selected text) is standard behaviour all the way from notepad to Word.
If you want non-standard behaviour, implement a DocumentFilter (see the API doc and/or Google) for your JTextPane

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.