I'm trying to build my own calculator piece by piece, and I've currently got it to the stage where it'll add positive integers. Anyway, at the moment I'm trying to incorporate the keyboard into the program.

What I've done is made is so that only my form can have focus, then added a keypressed event to the form. What I want is for the event to be able to determine which number (or symbol) is pressed, so I can assign its value to the two variables I have set up for carrying those values to their prospective methods, but I'm stuck. Can anyone help?

P.S. I'm rather new to Java, so layman's terms and/or explanations would really, really be appreciated thanks! :)

In your KeyPressed (KeyEvent e)class:
int getKey = e.getKeyCode();
if(getKey == KeyEvent.VK_0){
//if key 0 is pressed

Hey thanks guys!

I looked through that page before posting actually, and couldn't make sense of it. I think the whole source of confusion for me was that on that page I was being given the information kinda drowned in a whole bunch of other information, a skill I need to learn. I think I got everything settled now though, seeing just what I needed laid out before me. Thanks again.