what is wrong here? I want to change the icon of the jbutton when I press the space bar and go back to its original state when I release it
case KeyEvent.VK_SPACE:
ImageIcon i=new ImageIcon("image/heart.jpg");
ImageIcon c=new ImageIcon("hug.jpg");
if (keyCode == KeyEvent.PRESS)
jButton1.setIcon(i);
else if(keyCode == KeyEvent.RELEASE)
jButton1.setIcon(c);
break;