Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JOptionPane get value ?  RSS feed

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


In the coding above, how could I know if the user click "Cancel / OK" button ?

Thanks.
 
Rob Spoor
Sheriff
Posts: 21090
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the API: javax.swing.JOptionPane. You'll have to check the overloaded version with the most parameters though; Sun is severely lacking in its API documentation here...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> In the coding above, how could I know if the user click "Cancel / OK" button ?

run the code, click OK, see what 's' prints
run the code click Cancel, see what 's' prints
run the code click 'X', see what 's' prints
run the code click 'esc', see what 's' prints

you should be able to work out the differences, and code for it accordingly
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!