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
- ╖ Limit the type of text that can be entered in the text box.
- ╖ Display text captured from the keyboard.
- ╖ Edit a line of text.
- ╖ Post an event based on text input from the keyboard.
If the text box already contains text, the user can select the default text
and delete or edit it.
-
ALPHA_LOWER
- Character mask constant, input must be a lowercase alpha char.
-
ALPHA_TO_LOWER
- Character mask constant, input must be an alpha char (it will be converted to lowercase).
-
ALPHA_TO_UPPER
- Character mask constant, input must be an alpha char (it will be converted to uppercase).
-
ALPHA_UPPER
- Character mask constant, input must be an uppercase alpha char.
-
ALPHANUMERIC_LOWER
- Character mask constant, input must be a digit or a lowercase alpha char.
-
ALPHANUMERIC_TO_LOWER
- Character mask constant, input must be a digit or alpha char (it will be converted to lowercase).
-
ALPHANUMERIC_TO_UPPER
- Character mask constant, input must be a digit or alpha char (it will be converted to uppercase).
-
ALPHANUMERIC_UPPER
- Character mask constant, input must be a digit or an uppercase alpha char.
-
ANY
- Character mask constant, input can be any char.
-
BACKSPACE
- Character constant, the backspace character.
-
caret
- The zero-relative index of the character after the insertion point caret.
-
DEL
- Character constant, the delete character.
-
DIGIT
- Character mask constant, input must be a digit char.
-
DIGIT_OR_SIGN
- Character mask constant, input must be a digit or sign (+ or -) char.
-
editable
- If true the field is editable.
-
ENTER
- Character constant, the enter character.
-
ESCAPE
- Character mask constant, the char following this ESCAPE will be placed into input string.
-
mask
- The valid string format mask used to define legal field input.
-
maskStripEscapes
- A string containing all the mask string characters except the ones immediately after ESCAPE characters.
-
maskStripEscapesLen
- The length of maskStripEscapes.
-
SIGN
- Character mask constant, input must be a sign (+ or -) char.
-
FormattedTextField()
- Constructs a new FormattedTextField.
-
FormattedTextField(int)
- Constructs a new FormattedTextField with the specified number of columns.
-
FormattedTextField(String)
- Constructs a new FormattedTextField containing the specified text.
-
FormattedTextField(String, int)
- Constructs a new FormattedTextField containing the specified text and
able to have the specified number of columns.
-
applyMask(String)
- Returns a formatted string, given an input string and the current valid
string format mask.
-
getEditable()
- Gets whether the text field is currently editable.
-
getEditFont()
- Returns the font used for editing in this field.
-
getMask()
- Gets the current valid string format mask.
-
keyDown(Event, int)
- Processes KEY_PRESS and KEY_ACTION events.
-
minimumSize()
- Returns the minimum dimensions to properly display this component.
-
preferredSize()
- Returns the recommended dimensions to properly display this component.
-
setEditable(boolean)
- Sets whether the text field is editable.
-
setEditFont(Font)
- Sets the font used in the field.
-
setFillMask()
- Sets the text field's contents to be an input template.
-
setFont(Font)
- Takes no action, use setEditFont instead.
-
setMask(String)
- Sets the valid string format mask for this field.
-
stripMask(String)
- Strips escape characters from the given string.
-
validChar(String, int, char)
- Returns the next valid character in the input string.
ESCAPE
public final char ESCAPE
- Character mask constant, the char following this ESCAPE will be placed into input string.
DIGIT
public final char DIGIT
- Character mask constant, input must be a digit char.
SIGN
public final char SIGN
- Character mask constant, input must be a sign (+ or -) char.
DIGIT_OR_SIGN
public final char DIGIT_OR_SIGN
- Character mask constant, input must be a digit or sign (+ or -) char.
ALPHA_UPPER
public final char ALPHA_UPPER
- Character mask constant, input must be an uppercase alpha char.
ALPHA_LOWER
public final char ALPHA_LOWER
- Character mask constant, input must be a lowercase alpha char.
ALPHA_TO_UPPER
public final char ALPHA_TO_UPPER
- Character mask constant, input must be an alpha char (it will be converted to uppercase).
ALPHA_TO_LOWER
public final char ALPHA_TO_LOWER
- Character mask constant, input must be an alpha char (it will be converted to lowercase).
ALPHANUMERIC_UPPER
public final char ALPHANUMERIC_UPPER
- Character mask constant, input must be a digit or an uppercase alpha char.
ALPHANUMERIC_LOWER
public final char ALPHANUMERIC_LOWER
- Character mask constant, input must be a digit or a lowercase alpha char.
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).
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).
ANY
public final char ANY
- Character mask constant, input can be any char.
BACKSPACE
protected final int BACKSPACE
- Character constant, the backspace character.
ENTER
protected final int ENTER
- Character constant, the enter character.
DEL
protected final int DEL
- Character constant, the delete character.
editable
protected boolean editable
- If true the field is editable.
caret
protected int caret
- The zero-relative index of the character after the insertion point caret.
mask
protected String mask
- The valid string format mask used to define legal field input.
maskStripEscapes
protected String maskStripEscapes
- A string containing all the mask string characters except the ones immediately after ESCAPE characters.
maskStripEscapesLen
protected int maskStripEscapesLen
- The length of maskStripEscapes.
FormattedTextField
public FormattedTextField()
- Constructs a new FormattedTextField. It can have 256 columns.
FormattedTextField
public FormattedTextField(int i)
- Constructs a new FormattedTextField with the specified number of columns.
FormattedTextField
public FormattedTextField(String s)
- Constructs a new FormattedTextField containing the specified text.
It can have 256 columns.
FormattedTextField
public FormattedTextField(String s,
int i)
- Constructs a new FormattedTextField containing the specified text and
able to have the specified number of columns.
setMask
public void setMask(String mask)
- Sets the valid string format mask for this field.
- See Also:
- getMask
getMask
public String getMask()
- Gets the current valid string format mask.
- Returns:
- the string that defines valid input into this field.
- See Also:
- setMask
setEditFont
public void setEditFont(Font f)
- Sets the font used in the field.
- See Also:
- getEditFont
getEditFont
public Font getEditFont()
- Returns the font used for editing in this field.
- See Also:
- getEditFont
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
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
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
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
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 " - - ".
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.
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.
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
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
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