Member Avatar for chudapati09

I'm creating a calculator, and I'm required to have a feature of key press.

Ex:
I have a GUI with each numerical value (0 - 9) has a button. Now when the user press 7 on the keyboard, I need buttonSevenActionPerformed to be invoked.
The signature of buttonSevenActionPerformed is:
private void buttonSevenActionPerformed(java.awt.event.ActionEvent evt)

In buttonSevenActionPerformed, 7 is entered into a text field called "enterScreen"

Hi,
Check KeyListener interface. A tutorial could be found here

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.