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

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"

Check KeyListener interface. A tutorial could be found here

Hope this helps.