I'm trying to set a key listener to a specific column in a table shown as : |Quantity|Price| i'm using this code bellow:

private void tableKeyPressed(java.awt.event.KeyEvent evt) {                                 
    int keycode = evt.getKeyCode();
    if (keycode == KeyEvent.VK_ENTER) {
        pricetext.setText(Integer.toString(calculatesum()));
    }         
} 

the problem is when i modify the quantity i have to press "Enter" twice so the function inside the key listener method. (i assume the 1st enter pressed is meant for the column quantity and the 2nd is meant for the table).

thanks for help

0 Answers