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: 15286
    
    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 - A Test Data Generation Platform
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: 15286
    
    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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disable tab event in JTextArea
 
Similar Threads
JTextArea and Tab problem
Changing the function of the Tab key
disable
want to disable ALT+TAB key using java
Turning off Tab traversal in a JTextArea