Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disable tab event in JTextArea

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Low
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric, Thank you soo much. That is going to work out great for me.
Thanks again.
 
Eric Low
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic