Class symantec.itools.awt.FormattedTextField
All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.awt.FormattedTextField
Object
|
+----Component
|
+----TextComponent
|
+----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.
- Version:
- 1.1, August 30, 1997
- Author:
- Symantec
-
ALPHANUMERIC_LOWER
- Character mask constant, input must be a digit or a lowercase alpha character.
-
ALPHANUMERIC_TO_LOWER
- Character mask constant, input must be a digit or alpha character (it will be converted to lowercase).
-
ALPHANUMERIC_TO_UPPER
- Character mask constant, input must be a digit or alpha character (it will be converted to uppercase).
-
ALPHANUMERIC_UPPER
- Character mask constant, input must be a digit or an uppercase alpha character.
-
ALPHA_LOWER
- Character mask constant, input must be a lowercase alpha character.
-
ALPHA_TO_LOWER
- Character mask constant, input must be an alpha character (it will be converted to lowercase).
-
ALPHA_TO_UPPER
- Character mask constant, input must be an alpha character (it will be converted to uppercase).
-
ALPHA_UPPER
- Character mask constant, input must be an uppercase alpha character.
-
ANY
- Character mask constant, input can be any character.
-
BACKSPACE
- Character constant, the backspace character.
-
DEL
- Character constant, the delete character.
-
DIGIT
- Character mask constant, input must be a digit character.
-
DIGIT_OR_SIGN
- Character mask constant, input must be a digit or sign (+ or -) character.
-
ENTER
- Character constant, the enter character.
-
ESCAPE
- Character mask constant, the character following this ESCAPE will be placed into input string.
-
SIGN
- Character mask constant, input must be a sign (+ or -) character.
-
caret
- The zero-relative index of the character after the insertion point caret.
-
designTimeText
- The string passed to setText at design time.
-
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.
-
unformattedCurrent
- The valid characters currently in the textfield, with no formatting.
-
symantec.itools.awt.FormattedTextField()
- Constructs a new FormattedTextField.
-
symantec.itools.awt.FormattedTextField(int)
- Constructs a new FormattedTextField with the specified number of columns.
-
symantec.itools.awt.FormattedTextField(String)
- Constructs a new FormattedTextField containing the specified text.
-
symantec.itools.awt.FormattedTextField(String, int)
- Constructs a new FormattedTextField containing the specified text and
able to have the specified number of columns.
-
addNotify()
- Tells this component that it has been added to a container.
-
applyMask(String)
- Returns a formatted string, given an input string and the current valid
string format mask.
-
applyMaskToChar(char, int)
- Apply the mask at index to the given character.
-
countNonEscapeChars(int, int)
- Counts the possible number of non-escape characters before the given index.
-
filterChar(char, char)
- Filters the given target character with the given mask character
-
getEditFont()
-
-
getFormattedText()
- Gets the displayed contents of the component.
-
getMask()
- Gets the current valid string format mask.
-
getMaskTemplateString()
- Returns a string defining an input template.
-
getMinimumSize()
- Returns the minimum dimensions to properly display this component.
-
getPreferredSize()
- Returns the recommended dimensions to properly display this component.
-
getText()
- Gets the unformatted string of filtered characters.
-
minimumSize()
-
-
preferredSize()
-
-
processChar(int)
- Handles KEY_PRESS processing.
-
removeNotify()
- Tells this component that it is being removed from a container.
-
setEditFont(Font)
-
-
setEditable(boolean)
- Sets whether the text field is editable.
-
setFillMask()
- Clears the contents of the field and sets the text field's contents to
be an input template.
-
setMask(String)
- Sets the valid string format mask for this field.
-
setText(String)
- Sets the text of this TextComponent to the specified text
after passing the specified text throught the filter.
-
stripMask(String)
- Strips escape characters from the given string.
-
validChar(String, int, char)
- Returns the next valid character in the input string.
ALPHANUMERIC_LOWER
public final char ALPHANUMERIC_LOWER
- Character mask constant, input must be a digit or a lowercase alpha character.
ALPHANUMERIC_TO_LOWER
public final char ALPHANUMERIC_TO_LOWER
- Character mask constant, input must be a digit or alpha character (it will be converted to lowercase).
ALPHANUMERIC_TO_UPPER
public final char ALPHANUMERIC_TO_UPPER
- Character mask constant, input must be a digit or alpha character (it will be converted to uppercase).
ALPHANUMERIC_UPPER
public final char ALPHANUMERIC_UPPER
- Character mask constant, input must be a digit or an uppercase alpha character.
ALPHA_LOWER
public final char ALPHA_LOWER
- Character mask constant, input must be a lowercase alpha character.
ALPHA_TO_LOWER
public final char ALPHA_TO_LOWER
- Character mask constant, input must be an alpha character (it will be converted to lowercase).
ALPHA_TO_UPPER
public final char ALPHA_TO_UPPER
- Character mask constant, input must be an alpha character (it will be converted to uppercase).
ALPHA_UPPER
public final char ALPHA_UPPER
- Character mask constant, input must be an uppercase alpha character.
ANY
public final char ANY
- Character mask constant, input can be any character.
BACKSPACE
protected final int BACKSPACE
- Character constant, the backspace character.
DEL
protected final int DEL
- Character constant, the delete character.
DIGIT
public final char DIGIT
- Character mask constant, input must be a digit character.
DIGIT_OR_SIGN
public final char DIGIT_OR_SIGN
- Character mask constant, input must be a digit or sign (+ or -) character.
ENTER
protected final int ENTER
- Character constant, the enter character.
ESCAPE
public final char ESCAPE
- Character mask constant, the character following this ESCAPE will be placed into input string.
SIGN
public final char SIGN
- Character mask constant, input must be a sign (+ or -) character.
caret
protected int caret
- The zero-relative index of the character after the insertion point caret.
designTimeText
protected java.lang.String designTimeText
- The string passed to setText at design time. Returned from getText at design time.
mask
protected java.lang.String mask
- The valid string format mask used to define legal field input.
maskStripEscapes
protected java.lang.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.
unformattedCurrent
protected java.lang.String unformattedCurrent
- The valid characters currently in the textfield, with no formatting.
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.
- Parameters:
- i - the number of character columns
FormattedTextField
public FormattedTextField(String s)
- Constructs a new FormattedTextField containing the specified text.
It can have 256 columns.
- Parameters:
- s - the field text
FormattedTextField
public FormattedTextField(String s,
int i)
- Constructs a new FormattedTextField containing the specified text and
able to have the specified number of columns.
- Parameters:
- s - the field text
- i - the number of character columns
addNotify
public synchronized void addNotify()
- Tells this component that it has been added to a container.
This is a standard Java AWT method which gets called by the AWT when
this component is added to a container. Typically, it is used to
create this component's peer.
It has been overridden here to call addKeyListener.
- Overrides:
- addNotify in class TextField
- See Also:
- removeNotify
applyMask
protected java.lang.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.
applyMaskToChar
protected java.lang.String applyMaskToChar(char targetChar,
int index)
- Apply the mask at index to the given character.
- Parameters:
- char - targetChar the character to apply the mask to.
- int - index the index in the mask to use on the given character.
- Returns:
- A string with the given character with the mask
at the given index applied. An empty string if the character was
invalid or if the given index was an escape character index.
countNonEscapeChars
protected int countNonEscapeChars(int start,
int beforeIndex)
- Counts the possible number of non-escape characters before the given index.
- Parameters:
- int - start the index in the mask template to start from. Inclusive.
- int - beforeIndex the index in the mask template to count back from. Exclusive.
- Returns:
- int the number of possible non-escape characters allowed before the given index.
filterChar
protected char filterChar(char targetChar,
char maskChar)
- Filters the given target character with the given mask character
- Parameters:
- char - targetChar the character to apply the filter to.
- char - maskChar the character to use as a filter. Should match
one of the pre-defined types.
- See Also:
- applyMask, applyMaskToChar, ALPHA_TO_UPPER, ALPHA_TO_LOWER, ALPHANUMERIC_TO_UPPER, ALPHANUMERIC_TO_LOWER
getEditFont
public java.awt.Font getEditFont()
- Note: getEditFont() is deprecated.
-
getFormattedText
public java.lang.String getFormattedText()
- Gets the displayed contents of the component.
- Returns:
- the string currently displayed by the component.
- See Also:
- setText, getText
getMask
public java.lang.String getMask()
- Gets the current valid string format mask.
- Returns:
- the string that defines valid input into this field.
- See Also:
- setMask
getMaskTemplateString
public java.lang.String getMaskTemplateString()
- Returns a string defining an input template. The mask ESCAPE
characters will be place in the string. All other mask characters will
have spaces in place of them. For example, a mask of "99/-9/-9" results
in a string set to " - - ".
- Returns:
- the template string defined by the mask, with spaces as placeholders.
getMinimumSize
public java.awt.Dimension getMinimumSize()
- 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:
- getMinimumSize in class TextField
- See Also:
- getPreferredSize
getPreferredSize
public java.awt.Dimension getPreferredSize()
- 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:
- getPreferredSize in class TextField
- See Also:
- getMinimumSize
getText
public java.lang.String getText()
- Gets the unformatted string of filtered characters.
- Returns:
- the string of unformatted characters that were accepted by
the mask filtering process. At design time this returns the text passed
to setText.
- Overrides:
- getText in class TextComponent
- See Also:
- setText, getFormattedText
minimumSize
public java.awt.Dimension minimumSize()
- Note: minimumSize() is deprecated.
As of JDK version 1.1,
replaced by getMinimumSize().
-
- Overrides:
- minimumSize in class TextField
preferredSize
public java.awt.Dimension preferredSize()
- Note: preferredSize() is deprecated.
As of JDK version 1.1,
replaced by getPreferredSize().
-
- Overrides:
- preferredSize in class TextField
processChar
protected void processChar(int key)
- Handles KEY_PRESS processing.
- Parameters:
- int - the key that was pressed
removeNotify
public synchronized void removeNotify()
- Tells this component that it is being removed from a container.
This is a standard Java AWT method which gets called by the AWT when
this component is removed from a container. Typically, it is used to
destroy the peers of this component and all its subcomponents.
It has been overridden here to call removeKeyListener.
- Overrides:
- removeNotify in class TextComponent
- See Also:
- addNotify
setEditFont
public void setEditFont(Font f)
- Note: setEditFont() is deprecated.
-
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:
- isEditable
setFillMask
public void setFillMask()
- Clears the contents of the field and 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 " - - ".
setMask
public void setMask(String mask)
- Sets the valid string format mask for this field.
- Parameters:
- mask - the new valid string format mask
- See Also:
- getMask
setText
public void setText(String t)
- Sets the text of this TextComponent to the specified text
after passing the specified text throught the filter.
- Parameters:
- t - the new text to be set
- Overrides:
- setText in class TextComponent
- See Also:
- getText
stripMask
protected java.lang.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.
validChar
protected int validChar(String s,
int start,
char maskChar)
- 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
- maskChar - the mask character used to determine which input characters
are valid
All Packages Class Hierarchy This Package Previous Next Index