|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.JFormattedTextField.AbstractFormatter
javax.swing.text.DefaultFormatter
javax.swing.text.MaskFormatter
public class MaskFormatter
| Constructor Summary | |
|---|---|
MaskFormatter()
|
|
MaskFormatter(String mask)
Creates a MaskFormatter with the specified mask. |
|
| Method Summary | |
|---|---|
String |
getInvalidCharacters()
Returns a String containing the characters that are not valid for input for this MaskFormatter. |
String |
getMask()
Returns the mask used in this MaskFormatter. |
String |
getPlaceholder()
Returns the place holder String that is used in place of missing characters when the value doesn't completely fill in the spaces in the mask. |
char |
getPlaceholderCharacter()
Returns the character used in place of missing characters when the value doesn't completely fill the mask. |
String |
getValidCharacters()
Returns a String containing the characters that are valid for input for this MaskFormatter. |
boolean |
getValueContainsLiteralCharacters()
Returns true if stringToValue should return the literal characters in the mask. |
void |
install(JFormattedTextField ftf)
Installs this MaskFormatter on the JFormattedTextField. |
void |
setInvalidCharacters(String invalidCharacters)
Sets characters that are not valid for input. |
void |
setMask(String mask)
Sets the mask for this MaskFormatter. |
void |
setPlaceholder(String placeholder)
Sets the string to use if the value does not completely fill in the mask. |
void |
setPlaceholderCharacter(char placeholder)
Sets the char to use if the value does not completely fill in the mask. |
void |
setValidCharacters(String validCharacters)
Sets characters that are valid for input. |
void |
setValueContainsLiteralCharacters(boolean containsLiteralChars)
Determines whether stringToValue will return literal characters or not. |
Object |
stringToValue(String value)
Parses the text using the mask, valid characters, and invalid characters to determine the appropriate Object to return. |
String |
valueToString(Object value)
Returns a String representation of the Object value based on the mask. |
| Methods inherited from class javax.swing.text.DefaultFormatter |
|---|
clone, getAllowsInvalid, getCommitsOnValidEdit, getDocumentFilter, getOverwriteMode, getValueClass, setAllowsInvalid, setCommitsOnValidEdit, setOverwriteMode, setValueClass |
| Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatter |
|---|
getActions, getFormattedTextField, getNavigationFilter, invalidEdit, setEditValid, uninstall |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MaskFormatter()
public MaskFormatter(String mask)
throws ParseException
mask -
ParseException| Method Detail |
|---|
public String getMask()
public String getInvalidCharacters()
public void setInvalidCharacters(String invalidCharacters)
invalidCharacters is non-null then no characters contained
in it will be allowed to be input.
invalidCharacters - the String specifying invalid characters.public String getValidCharacters()
public void setValidCharacters(String validCharacters)
validCharacters is non-null then no characters that are
not contained in it will be allowed to be input.
validCharacters - the String specifying valid characters.public String getPlaceholder()
public void setPlaceholder(String placeholder)
placeholder - the String to use if the value doesn't completely
fill in the mask.public char getPlaceholderCharacter()
public void setPlaceholderCharacter(char placeholder)
placeholder - the char to use if the value doesn't completely
fill in the mask.public boolean getValueContainsLiteralCharacters()
public void setValueContainsLiteralCharacters(boolean containsLiteralChars)
containsLiteralChars - if true, stringToValue will return the
literal characters in the mask, otherwise it will not.
public void setMask(String mask)
throws ParseException
mask - the new mask for this MaskFormatter
ParseException - if mask is not valid.public void install(JFormattedTextField ftf)
install in class DefaultFormatterftf - the JFormattedTextField in which this formatter
is installed
public Object stringToValue(String value)
throws ParseException
stringToValue in class DefaultFormattervalue - the String to parse
ParseException - if value doesn't match the mask and valid/invalid
character sets
public String valueToString(Object value)
throws ParseException
valueToString in class DefaultFormattervalue - the value to convert
ParseException - if value is invalid for this mask and valid/invalid
character sets
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||