Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JOption Pane problem

 
Dan Grindstaff
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All, I am trying to get the following code to compile and run, I am getting an error message:

Here is the code:
 
Dan Grindstaff
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I figured out what was causing the problem, but now I would like to make a third JOptionpane that asks "would you like to try again?". The program should not end until the user selects 'no'.

Here is the cleaned up code:
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


What does df.format(...) do? You should read the method's API: Format#format(...)
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan,
In future, while posting code please do use code tags
 
Campbell Ritchie
Marshal
Posts: 52516
118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And I think this thread would sit better on the Swing forum. Moving.
 
Dan Grindstaff
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, all for your help. I am still wondering how to get a JOptionpane to persist. I want there to be a 'master' JOptionpane that asks something like 'would you like to try again?' and if no exit program. TIA.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wrap what you want to persist in a do/while

simple demo

 
Dan Grindstaff
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! Works like a charm.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!