Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

NEWBIE: How to end JOptionPane?

Posted on 2006-11-14
9
Medium Priority
?
244 Views
Last Modified: 2012-06-27
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
Comment
Question by:BrianMc1958
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17941732
Do you have a JFrame?
0
 

Author Comment

by:BrianMc1958
ID: 17941771
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
 

Author Comment

by:BrianMc1958
ID: 17941775
"This is just an internal tool, SO... "
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 6

Accepted Solution

by:
SamsonChung earned 500 total points
ID: 17941919
try System.exit(0)
0
 
LVL 6

Expert Comment

by:SamsonChung
ID: 17941924
This is a common thing. JOptionPane does this all the time :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17942028
Try it out *outside* Eclipse first to see if it's really a problem
0
 
LVL 6

Expert Comment

by:SamsonChung
ID: 17942042
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
 
LVL 92

Expert Comment

by:objects
ID: 17944469
you need to use System.exit(0) as SamsonChung suggested above.
0
 
LVL 6

Expert Comment

by:SamsonChung
ID: 17946937
Thank you.

(YES! I know my Cavaj :)
0

Featured Post

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month20 days, 20 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question