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...

Recommended Answers

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

Jump to Post

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.