?
Solved

Problem with JOptionPane

Posted on 2004-09-11
5
Medium Priority
?
254 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
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

Technology Partners: 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!

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

839 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