Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 JOptionPane help
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Williamarf




PostPosted: Fri Dec 21, 2012 6:03 pm   Post subject: JOptionPane help

How do I set functionality for the YES_NO_CANCEL_OPTION?
Sponsor
Sponsor
Sponsor
sponsor
Panphobia




PostPosted: Fri Dec 21, 2012 6:07 pm   Post subject: RE:JOptionPane help

What do you mean by set functionality?
Panphobia




PostPosted: Fri Dec 21, 2012 6:09 pm   Post subject: 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




PostPosted: Fri Dec 21, 2012 6:10 pm   Post subject: RE:JOptionPane help

By "set functionallity" I mean get them to do something.
Panphobia




PostPosted: Fri Dec 21, 2012 6:11 pm   Post subject: RE:JOptionPane help

http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
Williamarf




PostPosted: 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




PostPosted: 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




PostPosted: 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
Sponsor
sponsor
[Gandalf]




PostPosted: 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).
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: