I'm writing a program which involves having a user type in a combo box and the list of items should change to reflect the text in the box (similar to autocomplete when you type into Google)
However, my combo box will not update until I press Enter. It doesn't seem to update when regular keys are typed. I have tried adding all kinds of listeners to the combo box but none of them fix the problem.
Here is the code snippet that has been the most successful. It is called from the fxml code: onKeyReleased="#keyReleased". It works properly, but still only executes when Enter is pressed.
public void keyReleased() throws SQLException, ClassNotFoundException
{
String coname = custconame_combo.getValue();
scriptHandler = new ScriptHandler();
custconame_combo.getItems().clear();
int i = 0;
for (String s : scriptHandler.searchCustomer(coname))
{
System.out.println(s);
custconame_combo.getItems().add(s);
custconame_combo.show();
i += 1;
}
}
I have searched high and low and still can't seem to solve this issue.