i got this problem i used a JOptionPane in OptionDialog mode but i can't manage to set to default option that if i select the x in the upper right corner it closes itself; this is because in the declaration of the showOptionDialog it makes me selected only one of the Object[] array containing my choices this is the code
Object[] options = {"Vacanza","Cena","Prestazione","Bene"};
int choice = JOptionPane.showOptionDialog(frame,"Nuovo Prodotto","Scegli il prodotto",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[0]);
if (choice == 0) {
//things to do }
else if (choice == 1) {
//things to do }...
now i had to set the last parameter of the showoptiondialog as one of my choices resulting then if i select the X in the upper corner it anyway does the default choice when i just want it to close doing nothing, how can i fix this guys? pls help me