JComboBox to string
- by gabrielle fregil
I have a String array of names, and then I added it into an editable JComboBox.
The user can either pick his/her name from the choices or just input his/her name if not in the choices.
How do I put the user input into a new string variable?
String [] chooseName = { Mark, John, Allison, Jessica };
JComboBox combo = new JComboBox (chooseName);
combo.setEditable(true);
String chosenName = /* how do i place what the user inputed here? */