I want to know how to add shortcuts similar to Emacs’s in my Java application. For example C-x C-f and C-x b.
Thanks.
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.
Java provides a means to identify Modifier keys.
By Modifier keys I mean
These acan be paired with other normal key press buttons from your keyboard to identify whether a combination has been pressed.
e.getModifiers() can be used to identify the modifier as well as the mouse button clicked. This returns bit mask.
See here.
http://www.leepoint.net/notes-java/GUI-lowlevel/keyboard/keyboard.html
I would use it something like this for Ctrl. This is overly simplified code, but you will get an idea.