I have one input box and one button. Rather then always having to click the button to advance the program I would like to press the enter key. So instead of duplicating the code from the button to the input box I want to use the doClick() function.
My code for the button is under the action mouseClicked and the code for the input box is under keyPressed. This is what I have for the keyPressed event on the input box.
if event.keyCode == event.VK_ENTER:
enterClick = event.source.parent.getComponent(‘submitButton’)
I would think this should make the code for the submitButton’s mouseClicked event execute when enter is pressed, but it does nothing. You can see the button flash like it is being pressed, but test print statements don’t even execute.