title: JTable keypressed event is fired only for the first key pressed
body: <p>I'm creating a billing software, I want to display the item names from the database that match the values typed in items column of my JTable. To accomplish this i have added a KeyListener. Everything works fine except that only for the first key, the keypressed event is triggered. If I press the enter key then type again, it gets triggered once again. I want the keyevent to be triggered for every key that is typed into the column continuously, can anyone help me out....?</p>
  
  <p>I'll give the code snippet...I want the items from DB to be displayed in itable...</p>
  
  <pre><code>     public void keyPressed(KeyEvent e) {
          rows=table.getSelectedRow();
          cols=table.getSelectedColumn();
          if(cols==2){
             String code=(String)table.getValueAt(rows, cols);
  
             Statement stmt = null;
             ResultSet rs = null;
  
             for (int i =model1.getRowCount();i&gt;0; i--) {
                model1.removeRow(i-1);
              }
              table.changeSelection(rows,cols, false, false);
  
             itable.setVisible(true);
             int i=0;
             String SQL = "SELECT * FROM items where name like\'"+code+"%\' or
                             code=\'"+code+"\' order by name";
  
             try{
                 stmt =  (Statement) dbcon.con.createStatement();
                 rs = stmt.executeQuery(SQL);
                 while (rs.next()) {
                      model1.insertRow((i),new Object[]{""});
                      itable.setValueAt((Object)rs.getString("name"), i, 0);
                       i++;
                  }
  
              }
              catch(Exception e1){
                    table.editCellAt(rows,cols,null);
                    return;
  
              }}
          }
  </code></pre>