abhinav_bipnesh
Journeyman
Hi Guy,
I have started learning Swing programming in java and for that i am creating a sample calculator application. For this i have made the JtextField a non focus object so when i click any of JButton textField take the input without any problem. Now i want to add keyboard event to these button so that when i press any numeric key on keyboard the textFiekd have the input for it.
Say for example if I press Esc key then all the text in textField get clear or when I press Num 7 key then textField has text as 7. But I am not able to add key event to the JButton. So please tell me how to do so.
Any help will be appricated.
Thanks in advance.
I have started learning Swing programming in java and for that i am creating a sample calculator application. For this i have made the JtextField a non focus object so when i click any of JButton textField take the input without any problem. Now i want to add keyboard event to these button so that when i press any numeric key on keyboard the textFiekd have the input for it.
Say for example if I press Esc key then all the text in textField get clear or when I press Num 7 key then textField has text as 7. But I am not able to add key event to the JButton. So please tell me how to do so.
Any help will be appricated.
Thanks in advance.