|
-
September 20th, 2000, 12:24 PM
#1
Multi Dialogs
Any way to pop up a dialog box (warning) from another dialog box (input)? Want to tell user a field is required if they exit out of it without entering a value.
-
September 20th, 2000, 12:36 PM
#2
Re: Multi Dialogs
An easy way to do it is to use predefined JDialogs. For example, if you want to check to make sure that the user entered his username, you could use the following:
userName = uname.getText();
if (userName.equals(null) || userName.equals("") || userName.equals(" "))
{
JOptionPane.showMessageDialog(nameDialog,
"Please enter a valid user name.",
"Invalid User Name",
JOptionPane.WARNING_MESSAGE);
} //end if
You can find more info about these at:
http://web2.java.sun.com/docs/books/....html#features
---Splatt
"There's nothing more dangerous than a resourceful idiot." ---Dilbert
BWAHAHAHAHAHAHA! ---Murray
-
September 20th, 2000, 03:55 PM
#3
Re: Multi Dialogs
Thanks, this is what I was doing, but getting my warning dialog twice. I've added a condition:
if( ! e.isTemporary() ) {
and also code to reset focus after calling the dialog:
SwingUtilities.invokeLater (new Runnable () {
public void run() {
((JTextField)focusObject).requestFocus();
}
});
and all is well!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|