• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JOptionPane Problem...

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I have a JOptionPane that is giving the user options of OK and CANCEL. I am trying to execute code based on what the user presses, but can't get it to work and I can't seem to figure out what I'm doing wrong.
Here's my code:

When I press cancel, the code doesn't execute.
I printed out the value of "value" and it displays as 1. When I printed out the value of "CANCEL_OPTION" it is equal to 2.
Why isn't this working? I guess I don't understand exactly how int's are assigned for the different fields of JOptionPane and how to use them properly.
Could someone please help me?
Thanks!
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Jennifer,
try

cheers,
Chantal
reply
    Bookmark Topic Watch Topic
  • New Topic