JOptionPane.showOptionDialog standardno vraća rezultat dijaloga u vidu int promenljive.
Code:
//Custom button text
Object[] options = {"Da",
"Ne",
"Mozda"};
int n = JOptionPane.showOptionDialog(frame,
"Telo poruke",
"Naslov",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[2]);
Detaljno imaš na sledećem linku:
http://java.sun.com/docs/books...uiswing/components/dialog.html