I created this method:

```
public void comboS() {

    ResultSet rset = null;
    String sch = ((JTextField) ComboItemName.getEditor().getEditorComponent()).getText();
    try {
        rset = new JDBC.DB().getData("SELECT * FROM item_reg WHERE id LIKE '" + sch + "%';");
    } catch (Exception e) {
        System.out.println(e);
    }
    ComboItemName.removeAllItems();
    try {
        while (rset.next()) {
            String item = rset.getString("id");
            ComboItemName.addItem(item);
        }
    } catch (SQLException ex) {
        Logger.getLogger(jfilechooser.class.getName()).log(Level.SEVERE, null, ex);
    }
    System.out.println(sch);
    ComboItemName.setSelectedItem(null);
    ComboItemName.setPopupVisible(true);
    ((JTextField) ComboItemName.getEditor().getEditorComponent()).setText(sch);

}

```

I call this method in actionPerformed of the JComboBox(ComboItemName)..When I type HDD and hit enter it shows all the ids of hard disks in database..But I want this to be appear while I typing HDD.I think for that a keyEvent should be apply to the method like this.

```
public void comboS(java.awt.event.KeyEvent evt)

```

But I don't know how to call this method and where in combo box.give me some help for this.thanks.
Like this

![enter image description here](https://i.stack.imgur.com/fiycP.png)