edu.kzoo.util
Class ValidatedInputReader2

java.lang.Object
  |
  +--edu.kzoo.util.ValidatedInputReader2

public class ValidatedInputReader2
extends java.lang.Object

Kalamazoo College Utility Classes:
This class prompts for input from the user and validates responses. IT DOESN"T REALLY MAKE SENSE YET !!! This class is incomplete, currently handling only integer input. Furthermore, it is undoubtedly reinventing the wheel, but I haven't had the time to do a search for a class that provides appropriate validation.

Version:
Mar 19, 2004
Author:
Alyce Brady

Constructor Summary
ValidatedInputReader2()
           
 
Method Summary
 int getInteger(javax.swing.JFrame parentFrame, java.lang.String initialPrompt, int startOfRange, int endOfRange, int suggestedValue, java.lang.String clarificationPrompt)
          Puts up a dialog box displaying the initialPrompt, waits for the user's response, and validates it (the response must be a valid integer).
 int getInteger(javax.swing.JFrame parentFrame, java.lang.String initialPrompt, int suggestedValue, java.lang.String clarificationPrompt)
          Puts up a dialog box displaying the initialPrompt, waits for the user's response, and validates it (the response must be a valid integer).
 int getInteger(java.lang.String initialPrompt, int startOfRange, int endOfRange, int suggestedValue, java.lang.String clarificationPrompt)
          Puts up a dialog box displaying the initialPrompt, waits for the user's response, and validates it (the response must be a valid integer).
 int getInteger(java.lang.String initialPrompt, int suggestedValue, java.lang.String clarificationPrompt)
          Puts up a dialog box displaying the initialPrompt, waits for the user's response, and validates it (the response must be a valid integer).
 void makeDialog(javax.swing.JFrame parent, java.lang.String initialPrompt, int startOfRange, int endOfRange, int suggestedValue, java.lang.String clarificationPrompt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatedInputReader2

public ValidatedInputReader2()
Method Detail

getInteger

public int getInteger(java.lang.String initialPrompt,
                      int suggestedValue,
                      java.lang.String clarificationPrompt)
Puts up a dialog box displaying the initialPrompt, waits for the user's response, and validates it (the response must be a valid integer). If the user's response is invalid, it prompts the user again using the clarificationPrompt until the user enters a valid response or selects Cancel. If the user selects Cancel, getInteger returns the suggestedValue.

Parameters:
initialPrompt - the initial prompt to the user
suggestedValue - a suggested, valid value that is displayed to the user, and is also used as the default value if the user selects Cancel
clarificationPrompt - a follow-up prompt for input after the user has input invalid data

getInteger

public int getInteger(javax.swing.JFrame parentFrame,
                      java.lang.String initialPrompt,
                      int suggestedValue,
                      java.lang.String clarificationPrompt)
Puts up a dialog box displaying the initialPrompt, waits for the user's response, and validates it (the response must be a valid integer). If the user's response is invalid, it prompts the user again using the clarificationPrompt until the user enters a valid response or selects Cancel. If the user selects Cancel, getInteger returns the suggestedValue.

Parameters:
parentFrame - frame of application asking for input
initialPrompt - the initial prompt to the user
suggestedValue - a suggested, valid value that is displayed to the user, and is also used as the default value if the user selects Cancel
clarificationPrompt - a follow-up prompt for input after the user has input invalid data

getInteger

public int getInteger(java.lang.String initialPrompt,
                      int startOfRange,
                      int endOfRange,
                      int suggestedValue,
                      java.lang.String clarificationPrompt)
Puts up a dialog box displaying the initialPrompt, waits for the user's response, and validates it (the response must be a valid integer). If the user's response is invalid, it prompts the user again using the clarificationPrompt until the user enters a valid response or selects Cancel. If the user selects Cancel, getInteger returns the suggestedValue.

Parameters:
initialPrompt - the initial prompt to the user
startOfRange - the smallest value in the range of valid values
endOfRange - the largest value in the range of valid values
suggestedValue - a suggested, valid value that is displayed to the user, and is also used as the default value if the user selects Cancel
clarificationPrompt - a follow-up prompt for input after the user has input invalid data

getInteger

public int getInteger(javax.swing.JFrame parentFrame,
                      java.lang.String initialPrompt,
                      int startOfRange,
                      int endOfRange,
                      int suggestedValue,
                      java.lang.String clarificationPrompt)
Puts up a dialog box displaying the initialPrompt, waits for the user's response, and validates it (the response must be a valid integer). If the user's response is invalid, it prompts the user again using the clarificationPrompt until the user enters a valid response or selects Cancel. If the user selects Cancel, getInteger returns the suggestedValue.

Parameters:
parentFrame - frame of application asking for input
initialPrompt - the initial prompt to the user
startOfRange - the smallest value in the range of valid values
endOfRange - the largest value in the range of valid values
suggestedValue - a suggested, valid value that is displayed to the user, and is also used as the default value if the user selects Cancel
clarificationPrompt - a follow-up prompt for input after the user has input invalid data

makeDialog

public void makeDialog(javax.swing.JFrame parent,
                       java.lang.String initialPrompt,
                       int startOfRange,
                       int endOfRange,
                       int suggestedValue,
                       java.lang.String clarificationPrompt)