javabook
Class InputBox

java.lang.Object
  extended byjavabook.JavaBookDialog
      extended byjavabook.InputBox

public class InputBox
extends JavaBookDialog

This dialog is for getting a single input value. You can enter int, float, or double values.

This class is provided as freeware. You are free to use as provided or modify to your heart's content. But you use it at your own risk. No implied or explicit warranty is given.


Field Summary
 
Fields inherited from class javabook.JavaBookDialog
ERROR_ICON, INFO_ICON, NO_ICON, QUESTION_ICON, WARNING_ICON
 
Constructor Summary
InputBox(java.awt.Frame owner)
          Default constructor.
InputBox(java.awt.Frame owner, boolean modal)
          Constructs this dialog with 'owner' as its owner and display this dialog as modal if the parameter is true.
 
Method Summary
 double getDouble()
          Allows the user to enter a double value.
 double getDouble(java.lang.String text)
          Allows the user to enter a double value.
 float getFloat()
          Allows the user to enter a double value.
 float getFloat(java.lang.String text)
          Allows the user to enter a float value.
 int getInteger()
          Allows the user to enter an integer value.
 int getInteger(java.lang.String text)
          Allows the user to enter an integer value.
 java.lang.String getString()
          Allows the user to enter a String.
 java.lang.String getString(java.lang.String text)
          Allows the user to enter a String value.
 
Methods inherited from class javabook.JavaBookDialog
setIcon, setLocation, setTitle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputBox

public InputBox(java.awt.Frame owner)
Default constructor.

Parameters:
owner - a Frame object owner of this dialog

InputBox

public InputBox(java.awt.Frame owner,
                boolean modal)
Constructs this dialog with 'owner' as its owner and display this dialog as modal if the parameter is true. Otherwise, display this dialog as modeless.

Parameters:
owner - a Frame object owner of this dialog
modal - true for modal dialog; false for modeless dialog
Method Detail

getInteger

public int getInteger()
Allows the user to enter an integer value. Error message will be displayed if the value entered cannot be converted to an int. Default prompt "Enter an integer:" is used.

Returns:
the integer value entered by the user

getInteger

public int getInteger(java.lang.String text)
Allows the user to enter an integer value. Error message will be displayed if the value entered cannot be converted to an int. The parameter is the prompt for this dialog.

Parameters:
text - the prompt used in this dialog
Returns:
the integer value entered by the user

getDouble

public double getDouble()
Allows the user to enter a double value. Error message will be displayed if the value entered cannot be converted to a double. Default prompt "Enter a double:" is used.

Returns:
the double value entered by the user

getDouble

public double getDouble(java.lang.String text)
Allows the user to enter a double value. Error message will be displayed if the value entered cannot be converted to a double. The parameter is the prompt for this dialog.

Parameters:
text - the prompt used in this dialog
Returns:
the double value entered by the user

getFloat

public float getFloat()
Allows the user to enter a double value. Error message will be displayed if the value entered cannot be converted to a double. Default prompt "Enter a double:" is used.

Returns:
the double value entered by the user

getFloat

public float getFloat(java.lang.String text)
Allows the user to enter a float value. Error message will be displayed if the value entered cannot be converted to a float. The parameter is the prompt for this dialog.

Parameters:
text - the prompt used in this dialog
Returns:
the float value entered by the user

getString

public java.lang.String getString()
Allows the user to enter a String. Default prompt "Enter a string:" is used.

Returns:
the String value entered by the user

getString

public java.lang.String getString(java.lang.String text)
Allows the user to enter a String value. The parameter is the prompt for this dialog.

Parameters:
text - the prompt used in this dialog
Returns:
the String value entered by the user