?
Solved

Problem with JOptionPane

Posted on 2004-09-11
5
Medium Priority
?
244 Views
Last Modified: 2010-03-31
I have a command:

   int ret = JOptionPane.showConfirmDialog(this, "Each neural network will have over " + NeuralNet.warningSize() + " connections.\n"
                                                        + "Would you like to continue?", "Confirm Network Size", JOptionPane.YES_NO_OPTION);
                                                       
            if (ret == JOptionPane.NO_OPTION) return null;
       
which is run in a seperate thread.  I cannot click on the yes or no options, although I can click on the X or hit enter and tab and it works properly.  Why does the mouse not work on the buttons?
0
Comment
Question by:jjacksn
[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
5 Comments
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 12033888
try using EventQueue.invokeLater() to run the dialog on the event dispatch thread.
0
 
LVL 8

Expert Comment

by:pjcrooks2000
ID: 12034000
If objects says it then thats the answer ;)  you could tie in other mouse listeners to the buttons but they should be tied into the event dispatch thread not your own thread as the man himself has said above, I am not arguing with the man OBJ live on..........

Good luck to you!

pjcrooks2000
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 12038207
>> which is run in a seperate thread.

Could you show the full-code where you do this?

I think that you're unknowingly displaying the same JOptionPane again on click of the Yes or No buttons.
0
 
LVL 5

Expert Comment

by:Naeemg
ID: 12110074
your code works properly, can u explain ur problem in more details?
or show ur code where u use it?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 12357532
jjacksn, you should be a little more interactive with experts who try to help you on your page, and at least answer a few questions if they ask them in the process. Anyway, the answer you accepted seems to be right :)
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

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…
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 will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

801 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