Originally posted by Mohsen:
1) Firstly, is there an alternative method?
JOptionPane gives a quick way to display simple dialogs, but if you have more than one text field, I think you have the best options.
2) I noticed with method #2, the user has to press the Enter key or else the action event object is not fired.
3) So, how do all those dialog boxes work, where you can just enter a value in a text field and without either pressing the Enter key or changing focus via the Tab key, when pressing the apps main "go" button the values are read?
I can't quite picture what you are talking about here. Do you mean, in question #2, when you construct your own dialog you aren't getting an ActionEvent fired from the button on the dialog? The question there would be: is any listener registered with that button?
In #3, you have seen a program where you get a dialog to fill in values then you press a button on the main program to exit the dialog and process the dialog's fields? That's just weird.
4) Related to question #1, what's the preferred way of getting user data?
What Works Best For You, Your Program And Your Users. That's why
Java gives you several options. One size does not fit all.