You can do this with showMessageDialog() by creating a JComboBox and converting it to editable using setEditable() .
Example:
String[] list = {"A", "B", "C"}; JComboBox jcb = new JComboBox(list); jcb.setEditable(true); JOptionPane.showMessageDialog( null, jcb, "select or type a value", JOptionPane.QUESTION_MESSAGE);
You can get the value in JComboBox with:
jcb.getSelectedItem()
source share