Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 381
  • Last Modified:

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.
0
dkim18
Asked:
dkim18
  • 3
  • 2
2 Solutions
 
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
 
zzynxSoftware 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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Mayank SAssociate 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now