Solved

detectint JOptionPane.showMessageDialog()

Posted on 2004-04-15
6
371 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
[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
  • 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 50 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
Industry Leaders: 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 50 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

617 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