All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.FormattedTextField

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.TextComponent
                   |
                   +----java.awt.TextField
                           |
                           +----symantec.itools.awt.FormattedTextField

public class FormattedTextField
extends TextField
Creates a box in which the user can type text. Text formatting logic is applied to the user input.

Use FormattedTextField to

If the text box already contains text, the user can select the default text and delete or edit it.


Variable Index

 o ALPHA_LOWER
Character mask constant, input must be a lowercase alpha char.
 o ALPHA_TO_LOWER
Character mask constant, input must be an alpha char (it will be converted to lowercase).
 o ALPHA_TO_UPPER
Character mask constant, input must be an alpha char (it will be converted to uppercase).
 o ALPHA_UPPER
Character mask constant, input must be an uppercase alpha char.
 o ALPHANUMERIC_LOWER
Character mask constant, input must be a digit or a lowercase alpha char.
 o ALPHANUMERIC_TO_LOWER
Character mask constant, input must be a digit or alpha char (it will be converted to lowercase).
 o ALPHANUMERIC_TO_UPPER
Character mask constant, input must be a digit or alpha char (it will be converted to uppercase).
 o ALPHANUMERIC_UPPER
Character mask constant, input must be a digit or an uppercase alpha char.
 o ANY
Character mask constant, input can be any char.
 o BACKSPACE
Character constant, the backspace character.
 o caret
The zero-relative index of the character after the insertion point caret.
 o DEL
Character constant, the delete character.
 o DIGIT
Character mask constant, input must be a digit char.
 o DIGIT_OR_SIGN
Character mask constant, input must be a digit or sign (+ or -) char.
 o editable
If true the field is editable.
 o ENTER
Character constant, the enter character.
 o ESCAPE
Character mask constant, the char following this ESCAPE will be placed into input string.
 o mask
The valid string format mask used to define legal field input.
 o maskStripEscapes
A string containing all the mask string characters except the ones immediately after ESCAPE characters.
 o maskStripEscapesLen
The length of maskStripEscapes.
 o SIGN
Character mask constant, input must be a sign (+ or -) char.

Constructor Index

 o FormattedTextField()
Constructs a new FormattedTextField.
 o FormattedTextField(int)
Constructs a new FormattedTextField with the specified number of columns.
 o FormattedTextField(String)
Constructs a new FormattedTextField containing the specified text.
 o FormattedTextField(String, int)
Constructs a new FormattedTextField containing the specified text and able to have the specified number of columns.

Method Index

 o applyMask(String)
Returns a formatted string, given an input string and the current valid string format mask.
 o getEditable()
Gets whether the text field is currently editable.
 o getEditFont()
Returns the font used for editing in this field.
 o getMask()
Gets the current valid string format mask.
 o keyDown(Event, int)
Processes KEY_PRESS and KEY_ACTION events.
 o minimumSize()
Returns the minimum dimensions to properly display this component.
 o preferredSize()
Returns the recommended dimensions to properly display this component.
 o setEditable(boolean)
Sets whether the text field is editable.
 o setEditFont(Font)
Sets the font used in the field.
 o setFillMask()
Sets the text field's contents to be an input template.
 o setFont(Font)
Takes no action, use setEditFont instead.
 o setMask(String)
Sets the valid string format mask for this field.
 o stripMask(String)
Strips escape characters from the given string.
 o validChar(String, int, char)
Returns the next valid character in the input string.

Variables

 o ESCAPE
  public final char ESCAPE
Character mask constant, the char following this ESCAPE will be placed into input string.

 o DIGIT
  public final char DIGIT
Character mask constant, input must be a digit char.

 o SIGN
  public final char SIGN
Character mask constant, input must be a sign (+ or -) char.

 o DIGIT_OR_SIGN
  public final char DIGIT_OR_SIGN
Character mask constant, input must be a digit or sign (+ or -) char.

 o ALPHA_UPPER
  public final char ALPHA_UPPER
Character mask constant, input must be an uppercase alpha char.

 o ALPHA_LOWER
  public final char ALPHA_LOWER
Character mask constant, input must be a lowercase alpha char.

 o ALPHA_TO_UPPER
  public final char ALPHA_TO_UPPER
Character mask constant, input must be an alpha char (it will be converted to uppercase).

 o ALPHA_TO_LOWER
  public final char ALPHA_TO_LOWER
Character mask constant, input must be an alpha char (it will be converted to lowercase).

 o ALPHANUMERIC_UPPER
  public final char ALPHANUMERIC_UPPER
Character mask constant, input must be a digit or an uppercase alpha char.

 o ALPHANUMERIC_LOWER
  public final char ALPHANUMERIC_LOWER
Character mask constant, input must be a digit or a lowercase alpha char.

 o ALPHANUMERIC_TO_UPPER
  public final char ALPHANUMERIC_TO_UPPER
Character mask constant, input must be a digit or alpha char (it will be converted to uppercase).

 o ALPHANUMERIC_TO_LOWER
  public final char ALPHANUMERIC_TO_LOWER
Character mask constant, input must be a digit or alpha char (it will be converted to lowercase).

 o ANY
  public final char ANY
Character mask constant, input can be any char.

 o BACKSPACE
  protected final int BACKSPACE
Character constant, the backspace character.

 o ENTER
  protected final int ENTER
Character constant, the enter character.

 o DEL
  protected final int DEL
Character constant, the delete character.

 o editable
  protected boolean editable
If true the field is editable.

 o caret
  protected int caret
The zero-relative index of the character after the insertion point caret.

 o mask
  protected String mask
The valid string format mask used to define legal field input.

 o maskStripEscapes
  protected String maskStripEscapes
A string containing all the mask string characters except the ones immediately after ESCAPE characters.

 o maskStripEscapesLen
  protected int maskStripEscapesLen
The length of maskStripEscapes.

Constructors

 o FormattedTextField
  public FormattedTextField()
Constructs a new FormattedTextField. It can have 256 columns.

 o FormattedTextField
  public FormattedTextField(int i)
Constructs a new FormattedTextField with the specified number of columns.

 o FormattedTextField
  public FormattedTextField(String s)
Constructs a new FormattedTextField containing the specified text. It can have 256 columns.

 o FormattedTextField
  public FormattedTextField(String s,
                            int i)
Constructs a new FormattedTextField containing the specified text and able to have the specified number of columns.

Methods

 o setMask
  public void setMask(String mask)
Sets the valid string format mask for this field.

See Also:
getMask
 o getMask
  public String getMask()
Gets the current valid string format mask.

Returns:
the string that defines valid input into this field.
See Also:
setMask
 o setEditFont
  public void setEditFont(Font f)
Sets the font used in the field.

See Also:
getEditFont
 o getEditFont
  public Font getEditFont()
Returns the font used for editing in this field.

See Also:
getEditFont
 o setFont
  public void setFont(Font f)
Takes no action, use setEditFont instead. This is a standard Java AWT method which gets called to change the font used for drawing text in this component. It has been overridden to eliminate it. Use setEditFont instead.

Parameters:
f - the new font to use for drawing text
Overrides:
setFont in class Component
See Also:
setEditFont, getFont
 o setEditable
  public void setEditable(boolean f)
Sets whether the text field is editable.

Parameters:
f - true if the text field is editable, false otherwise
Overrides:
setEditable in class TextComponent
See Also:
getEditable
 o getEditable
  public boolean getEditable()
Gets whether the text field is currently editable.

Returns:
true if the text field is currently editable, false otherwise
See Also:
setEditable
 o validChar
  protected int validChar(String s,
                          int start,
                          char mc)
Returns the next valid character in the input string.

Parameters:
s - the input string
start - the zero-relative index of the first character to check in the input string
mc - the mask character used to determine which input characters are valid
 o setFillMask
  protected void setFillMask()
Sets the text field's contents to be an input template. The mask ESCAPE characters will be place in the field. All other mask characters will have spaces in place of them. For example, a mask of "99/-9/-9" results in the text field getting set to " - - ".

 o applyMask
  protected String applyMask(String s)
Returns a formatted string, given an input string and the current valid string format mask.

Parameters:
s - the input string
Returns:
the input string formatted using the current valid string format mask.
 o stripMask
  protected String stripMask(String s)
Strips escape characters from the given string. For example, a mask of "99/-9/-9" and an input string of "12-3-4" results in "1234".

Parameters:
s - the input string
Returns:
the input string stripped of mask escape characters.
 o keyDown
  public boolean keyDown(Event evt,
                         int key)
Processes KEY_PRESS and KEY_ACTION events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a KEY_PRESS or KEY_ACTION event. These events occur when this component has the focus and the user presses a "normal" or an "action" (F1, page up, etc) key.

Parameters:
evt - the Event
key - the key that was pressed
Returns:
true if the event was handled
Overrides:
keyDown in class Component
See Also:
keyUp, handleEvent
 o preferredSize
  public Dimension preferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Overrides:
preferredSize in class TextField
See Also:
minimumSize
 o minimumSize
  public Dimension minimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Overrides:
minimumSize in class TextField
See Also:
preferredSize

All Packages  Class Hierarchy  This Package  Previous  Next  Index