Originally posted by Mohsen:
1) Firstly, is there an alternative method?
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?
4) Related to question #1, what's the preferred way of getting user data?
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Originally posted by Nathan Pruett:
"Mohsen" -
Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.
Sorry, but I don't think I understand all of your question... are you asking about the difference between using JOptionPane and hand-coding a JDialog in the first part?
The later part sounds like you might want to set some kind of default button activated by a keypress, but I'm not sure if that is what you meant by "the apps main "go" button".
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Originally posted by cj jack:
I am new to the Swing components. But correct me if I am wrong, but can't you do something along the lines of attaching an event to your "OK" button to pull the data from the TextField component entered by the user.
For example:
Craig
rubbery bacon. rubbery tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|