Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

detectint JOptionPane.showMessageDialog()

Posted on 2004-04-15
6
Medium Priority
?
379 Views
Last Modified: 2010-03-31
hi!

I am trying to detect whether JOptionPane.showMessageDialog() was pop  when I clicked "next" button.
JOptionPane.showMessageDialog() are in other classes. How do I do that?

Thanks in advance.
0
Comment
Question by:dkim18
  • 3
  • 2
6 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 10834004
What do you mean by "detect"? If it pops up, you will see it.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10834062
>> JOptionPane.showMessageDialog() are in other classes

Do you mean to say that from one class, you want to check if a JOptionPane was displayed in another running class? Why?
0
 
LVL 37

Accepted Solution

by:
zzynx earned 200 total points
ID: 10835981
If you want to know that you better keep a flag (boolean msgShowing) in the class that shows the dialog.
You set msgShowing=true; when the dialog is shown.
You have to reset it when the user closes it. (via a listener)

Any other class can call the function getMsgShowing() [which returns the msgShowing variable] to know if the message is being shown or not.
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 30

Assisted Solution

by:Mayank S
Mayank S earned 200 total points
ID: 10839258
Yes, but it has to be done in the same instance of the VM. The boolean msgShowing might as well serve good if it is static. But you cannot run java Program1 and java Program2 and detect in Program2 if Program1 showed a JOptionPane, that way - because both are running in different instances of the JVM. You can write to files, etc - bad approach. In the same instance of the VM, it might be possible if the two classes are running in different threads.
0
 

Author Comment

by:dkim18
ID: 10873907
This question is not good anymore, b/c I found other solution.
Thanks anyway. I will split points for you.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 10875611
Thanks for accepting
0

Featured Post

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!

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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…
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.
Suggested Courses

782 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