?
Solved

NEWBIE: How to end JOptionPane?

Posted on 2006-11-14
9
Medium Priority
?
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

752 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