Solved

NEWBIE: How to end JOptionPane?

Posted on 2006-11-14
9
229 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
 
LVL 6

Accepted Solution

by:
SamsonChung earned 125 total points
ID: 17941919
try System.exit(0)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now