detectint JOptionPane.showMessageDialog()

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.
dkim18Asked:
Who is Participating?
 
zzynxConnect With a Mentor Software engineerCommented:
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
 
Mayank SAssociate Director - Product EngineeringCommented:
What do you mean by "detect"? If it pops up, you will see it.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> 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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Mayank SConnect With a Mentor Associate Director - Product EngineeringCommented:
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
 
dkim18Author Commented:
This question is not good anymore, b/c I found other solution.
Thanks anyway. I will split points for you.
0
 
zzynxSoftware engineerCommented:
Thanks for accepting
0
All Courses

From novice to tech pro — start learning today.