How about a class for simple input?
I have created the SimpleInput class to let you get input from a user via a pop-up dialog box. It uses the swing class javax.swing.JOptionPane. All of these check that the user actually input what was asked for and if not will ask again.
To use it just right click on SimpleInput.java and then click on "Save Target As" and put it in your bookClasses directory. Do the same thing with
Then in the interactions pane or in a method try:
double number = SimpleInput.getNumber("Please enter a number");
or to get an integer try:
int number = SimpleInput.getIntNumber("Please enter an integer");
or to get a String try:
String answer = SimpleInput.getString("What is your name?");
or to get an integer between a minimum and maximum value try:
int number = SimpleInput.getIntNumber("Enter a number from 1 to 10",1,10);
Link to this Page
- Questions last edited on 30 January 2006 at 1:29 pm by user-11216ng.dsl.mindspring.com