Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

NEWBIE: How to end JOptionPane?

Dear Experts,

I just popped a JOptionPane (thanks, CEHJ!) into a class.  Works beautifully, but after I click "Yes", and the box goes away, and my class would otherwise end, it does not end.  I'm assuming I have to explicitly kill the JOptionPane thread, but I don't know how?  (I'm running it inside of Eclipse.)

This is the code snippet:

Object[] options =
{
"Yes", "No"
};
int n = JOptionPane.showOptionDialog(null, "Some Question? "
                        , "Some Title", JOptionPane.YES_NO_CANCEL_OPTION,
                        JOptionPane.QUESTION_MESSAGE, null, options, options[1]);

return n;


Thanks again,
BrianMc1958
0
BrianMc1958
Asked:
BrianMc1958
  • 4
  • 2
  • 2
  • +1
1 Solution
 
CEHJCommented:
Do you have a JFrame?
0
 
BrianMc1958Author Commented:
No.  (AFAIK.)  This is just an internal tool, to I'm using NULL for the frame, and it's then popping up inside of Eclipse.  If there is no easy solution here, that's fine.  I can always kill it manually...
0
 
BrianMc1958Author Commented:
"This is just an internal tool, SO... "
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
SamsonChungCommented:
try System.exit(0)
0
 
SamsonChungCommented:
This is a common thing. JOptionPane does this all the time :)
0
 
CEHJCommented:
Try it out *outside* Eclipse first to see if it's really a problem
0
 
SamsonChungCommented:
i have seen this problem before....
and I was on UNIX csh....

It is similar to a JFrame being .hide() instead of System.exit(0).
0
 
objectsCommented:
you need to use System.exit(0) as SamsonChung suggested above.
0
 
SamsonChungCommented:
Thank you.

(YES! I know my Cavaj :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now