0

Its maybe a pretty simple question but i stuck there anyway.

You can set an JComboBox to Editable to insert Values. Normaly theire used for filtering the list.

What i want is that wenn the User enter a Value an exit the field, the programm should check wether the Value is already in the List and if not. It should add it to the list.

I would add a Code Snipped. But at the moment i only got the declaration for the ComboBox.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Chase
  • 88
  • 1
  • 8
  • Use a model for combobox and add the model to the combobox. Add items to the model statically or dynamically. The items will get displayed in the combobox. http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html – AJJ Jun 26 '14 at 13:09
  • @Jayaprasad: The main Problem is that i dont know how to read out the Textfield of the Combobox. – Chase Jun 26 '14 at 13:10
  • possible duplicate of [editable JComboBox](http://stackoverflow.com/questions/6395164/editable-jcombobox) – Nivas Jun 26 '14 at 13:11
  • combo.getEditor().getItem(); – AJJ Jun 26 '14 at 13:13
  • may be duplicate of http://stackoverflow.com/questions/10072335/get-input-values-from-jcombobox – AJJ Jun 26 '14 at 13:13
  • @Nivas: Jep it its... I searched but didnt found it. Thanks – Chase Jun 26 '14 at 13:17
  • 1
    @Jayaprasad: Worked. Thanks and yes it is... I'm just to dumb to search... – Chase Jun 26 '14 at 13:18

0 Answers0