Hello there,
I am having a problem binding keys to buttons in netbeans. I have an app that has a textfield that gets input from a series of 8 buttons. i want to map the numpad to these buttons ONLY when the textfield is the focus. so far I have implemented a rough KeyPressed listener that filters VK_NUMPADX through an if statement, but this is problematic. First and foremost, the button i press is also added to the textfield, i.e. if i map VK_NUMPAD1 to essentially paste "Hello", the textfield reads Hello1. Secondly, I have simply copy-pasted the contents of each button's action performed method into the if statements, which seems to be too brute force... how do i call the buttonActionPerformed method directly within this Keypressed method??
I hope i am clear enough to elicit a response
thanks for your time and help!