Solved

detectint JOptionPane.showMessageDialog()

Posted on 2004-04-15
6
337 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 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java 1603 Error 3 50
firstChar challenge 13 107
for i loop in grovy 1 44
backtracking recursion  code 19 53
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

919 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now