I want to create a dialog box which contain four button
- yes
- no
- yes to all
- cancel
I’m able to create dialog but I am unable to add action in yes to all button.
Object[] options = {"Yes", "No", "Yes To All", "Cancel"};
int n = JOptionPane.showOptionDialog(MainGui.appView, "file "+tempFile+
"exits.\n Do you wish to overwrite?", "Question",
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,
null, options, options[2]);
Check for value of
n. It will be as follows:You can switch over
nand do action respectively.