How do I detect the combination key Shift+Tab in a JTextField?
How do I detect the combination key Shift + Tab in a JTextField ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is a bit of a special case since Shift+Tab is a focus traversal key. The focus subsystem normally consumes focus traversal keys, so you’ll need to prevent that by calling
on your
JTextField. You’ll then be able to detect the Shift+Tab combination and handle it yourself.See How to Write a Key Listener for an example program you can download and experiment with to see how it works.