This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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!
 
 
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