File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Disable tab event in JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Disable tab event in JTextArea" Watch "Disable tab event in JTextArea" New topic
Author

Disable tab event in JTextArea

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Is there a way to do this? I need to disable it, so that I can force the TAB key to move to the next focusable component, instead of spacing in the JTextArea.
Thanks.


GenRocket - Experts at Building Test Data
Eric Low
Ranch Hand

Joined: Mar 14, 2002
Posts: 41
Try this:

The above code basically detect the TAB keystroke in JTextPane and perform your "pre-defined" action instead.
Hope this helps.
Cheers
Eric Low
SCJP2
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Eric, Thank you soo much. That is going to work out great for me.
Thanks again.
Eric Low
Ranch Hand

Joined: Mar 14, 2002
Posts: 41
You're welcome!
 
jQuery in Action, 2nd edition
 
subject: Disable tab event in JTextArea
 
Similar Threads
Changing the function of the Tab key
JTextArea and Tab problem
disable
Turning off Tab traversal in a JTextArea
want to disable ALT+TAB key using java