I have a onClick: function(event). All I want is to assign a shortcut key for this onClick event. When the link is clicked execute a shortcut key, for example: ctrl+D.
Thank you.
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.
In a simpler way, you wouldn’t actually try to add a
shortcutfor youronClick()event. What you would actually want is to add aKeyListenerto a specific component (basically the same component on which you’ve added theMouseListener) and you would try to perform the same action as you’re doing when the user clicks on the component.“How to Write a Key Listener” might be a good place to start to understand more about
KeyListeners.Another useful link for you might be this: “How to Use Key Bindings”