Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Help coderanch get a
new server
by contributing to the
fundraiser
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Swing / AWT / SWT
Disable tab event in JTextArea
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Try this:
JTextPane inputTextPane = new JTextPane(); private AbstractAction tabAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { //replace here with your own action inputTextPane.replaceSelection("\u00A0\u00A0\u00A0\u00A0"); } }; KeyStroke tabKey = KeyStroke.getKeyStroke("TAB"); inputTextPane.getInputMap().put(tabKey, tabAction);
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
Ranch Hand
Posts: 15304
6
I like...
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Eric, Thank you soo much. That is going to work out great for me.
Thanks again.
Eric Low
Ranch Hand
Posts: 41
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You're welcome!
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Changing the function of the Tab key
JTextArea and Tab problem
want to disable ALT+TAB key using java
Turning off Tab traversal in a JTextArea
disable
More...