reset a jcombobox at the end of completing the form

0

I'm filling out a form.

To avoid the error of the user in one of the campos to fill it I limit it to a combobox , and when it completes the filling and sends, I can delete everything, but the combobox remains in the value that leave the user.

The values I have in the program code, what I'm going to is that I select one of the values that it has (in this case they are cities) to fill out the form, when I finish sending that data to my base, and clean the form, but in the JCombobox the same value is kept selected and it does not return to the blank selection, example I select "NEW YORK", clean the form and remain in that selection, not returning to "SELECT CITY". I explain now ?? Attempts I have not made because I do not know how to do it, therefore I did not put in my hand because I do not know where to start. Thanks

I will try to explain it again. The valores seleccionables I have loaded by código of sw , no come from base de datos . As I added in the edition, my user fills out the form, when it reaches combobox it says "Select city" , the user changes it to the one he needs. Finish filling the formulario , click in ENVIAR and save the data in base de datos and take the button event to delete the fields of the form, but the combobox do not return to "Select city" . That's what I want to do. Now if I explained clearly?

    
asked by Vizz3rdriX 31.10.2018 в 12:00
source

1 answer

0

It would be nice to know your code, but for what you comment it could be worth introducing this line of code in the function that you use to reset your form.

jComboBox1.setSelectedIndex(0);
    
answered by 31.10.2018 в 12:19