Solved

opening a password verification JFrame while program is running.

Posted on 2003-11-05
3
322 Views
Last Modified: 2012-05-04
Hi.

it is a bit hard to explain what i am trying to do, but i will try.
I have a program i wrote, which is running all the time through a connection and calculate things.
And i want to open a JFrame for verificating a password for making some operations in it.
I have managed to create the JFrame with the user and password fields and the buttons.
but i have trouble making the main program / JFrame to wait for the user.

i am looking to make some sort of:
String inputValue = JOptionPane.showInputDialog("Please input a value");

or:
boolean verified = MyOptionPane.waitForVerification();
which opens a JFrame for the user to enter the user and password.

i hope i made myself clear enough here.

Thank you.
0
Comment
Question by:cicurel
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 250 total points
ID: 9686359
Use a JDialog instead of a JFrame, and

setModal( true ) ;
0
 

Author Comment

by:cicurel
ID: 9686549
Thank you very much, it appears i used the JDialog, what does the setModal means?
it is much easier then i thought :)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9686564
A modal dialog will freeze execution till you answer it :-)

Not sure why it's called "modal" the dictionary doesn't really help either...something about:

Modal : Something with logical Modality
Modality : The state of a Modal object

bah...language recursion ;-)

So if you set the dialog modal, the program will wait until that dialog is no longer visible (hide() or user closes it)

Good luck!

Tim.
0

Featured Post

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
servlet filter example 37 83
tomcat startup error 5 135
hashmap order 17 40
activeMQ Queue Messages Enqueued and Messages Dequeued 1 31
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…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

756 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