Solved

NEWBIE: How to end JOptionPane?

Posted on 2006-11-14
9
234 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
Industry Leaders: 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 125 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ejb example issues 3 55
Is Applet the way to go for my drag and drop system? 8 35
Java syntax, or is it Selenium 6 42
hashmap order 17 42
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

726 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