I\'m trying to get the value returned by custom buttons passed to JOptionPane. However the buttons I pass don\'t return a value at all. Only when the exit button is pressed
You don't have to define your buttons explicitly.
int result = JOptionPane.showOptionDialog(this, "Are you sure you want to...?", "Title", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Yes", "No" }, JOptionPane.NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
...
}