
-----------------------------------
Williamarf
Fri Dec 21, 2012 6:03 pm

JOptionPane help
-----------------------------------
How do I set functionality for the YES_NO_CANCEL_OPTION?

-----------------------------------
Panphobia
Fri Dec 21, 2012 6:07 pm

RE:JOptionPane help
-----------------------------------
What do you mean by set functionality?

-----------------------------------
Panphobia
Fri Dec 21, 2012 6:09 pm

RE:JOptionPane help
-----------------------------------
Here is some wonderful info on the swing class on oracle http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html

-----------------------------------
Williamarf
Fri Dec 21, 2012 6:10 pm

RE:JOptionPane help
-----------------------------------
By "set functionallity" I mean get them to do something.

-----------------------------------
Panphobia
Fri Dec 21, 2012 6:11 pm

RE:JOptionPane help
-----------------------------------
http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html

-----------------------------------
Williamarf
Fri Dec 21, 2012 6:25 pm

RE:JOptionPane help
-----------------------------------
Yes it is a great site but it does not tell me anything about getting the yes no buttons to do anything.

-----------------------------------
Panphobia
Fri Dec 21, 2012 6:34 pm

Re: JOptionPane help
-----------------------------------
It actually gives you all the information you need, you just weren't looking into it this is what you were looking for I think [code] int n = JOptionPane.showConfirmDialog(
    null,
    "Would you like green eggs and ham?",
    "An Inane Question",
    JOptionPane.YES_NO_OPTION);[/code]

-----------------------------------
Williamarf
Sun Dec 23, 2012 1:22 am

RE:JOptionPane help
-----------------------------------
no. I saw that. but it only tells me how to get the buttons not how to get the yes no buttons to do anything.

-----------------------------------
[Gandalf]
Sun Dec 23, 2012 4:49 am

RE:JOptionPane help
-----------------------------------
Since JOptionPane dialogs are all modal, you just take the value returned by the dialog and do what you want after it.  The button or option selected is returned from the show dialog function (i.e. n in the above example).
