Author |
Message |
Williamarf
|
Posted: Fri Dec 21, 2012 6:03 pm Post subject: JOptionPane help |
|
|
How do I set functionality for the YES_NO_CANCEL_OPTION? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Panphobia
|
Posted: Fri Dec 21, 2012 6:07 pm Post subject: RE:JOptionPane help |
|
|
What do you mean by set functionality? |
|
|
|
|
|
Panphobia
|
|
|
|
|
Williamarf
|
Posted: Fri Dec 21, 2012 6:10 pm Post subject: RE:JOptionPane help |
|
|
By "set functionallity" I mean get them to do something. |
|
|
|
|
|
Panphobia
|
|
|
|
|
Williamarf
|
Posted: Fri Dec 21, 2012 6:25 pm Post subject: 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
|
Posted: Fri Dec 21, 2012 6:34 pm Post subject: 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); |
|
|
|
|
|
|
Williamarf
|
Posted: Sun Dec 23, 2012 1:22 am Post subject: 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. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
[Gandalf]
|
Posted: Sun Dec 23, 2012 4:49 am Post subject: 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). |
|
|
|
|
|
|