-Java Development Kit (JDK) must be installed.
-Also the computer system must have Java IDE installed. Probably Netbeans.
we are going to learn the events handling in Java programming. Sometime, the users prefer clicking by using the keyboard than using the mouse. The sum operation can be done by entering keyboard below. The code is added is
if(e.getKeyCode()==e.VK_ENTER)
the full code below
private void resultKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if(e.getKeyCode()==e.VK_ENTER)
{
int x=Integer.parseInt(data1.getText());
int y=Integer.parseInt(data2.getText());
String z=String.valueOf(x+y);
result.setText(z);
}
}
The result is displayed in picture below
my project is in github
This is my first tutorial about Java programming