|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.InputVerifier
org.brains2b.swingext.mask.DateValidator
public class DateValidator
DateValidator is an InputValidator that functions like a display mask for dates.
For the format of the Date any valid format as defined in SimpleDateFormat can be used. The date inputted will be displayed conforming to this format.
NoteYou can display time information through the mask, but the verify does not allow inserting of times, so the current time will be displayed.
ddMMyy
day-month-year
day
can be either 1 or 2 digits, with or without a leading 0
month
can be either 1 or 2 digits, with or without a leading 0, a String representing
the long name or a short name of the month. The name of the month must be in the same
language for the Locale the DateValidator is instantiated with.
year
can be 1 or 2 digits, with or without a leading 0. This is interpreted as
a year without a century, so the current century is added. It can also be four digits and will
then be intrepeted as year including a century.
SimpleDateFormat
Constructor Summary | |
---|---|
DateValidator()
Constructor for DateValidator. |
|
DateValidator(java.util.Locale locale)
Constructor for DateValidator. |
|
DateValidator(java.util.Locale locale,
java.lang.String mask)
Constructor for DateValidator. |
Method Summary | |
---|---|
java.lang.String |
getErrorMessage()
retrieves the errormessage if verify returns false. |
java.lang.String |
getLocalizedMessage()
retrieve the error message, localized to the default locale if verify returns false |
java.lang.String |
getString(java.lang.String txt)
gets a String as representation of the value from a InputValidator Implementations might differ on what you need the value for. |
java.lang.String |
getString(java.lang.String txt,
java.lang.Class c)
gets a String as representation of the value from a InputValidator Implemenations differ for the implementations of this interface and on which Class is supplied for output. |
boolean |
verify(javax.swing.JComponent input)
Just a reference to verify in javax.swing.InputVerifier |
Methods inherited from class javax.swing.InputVerifier |
---|
shouldYieldFocus |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateValidator()
The default mask is set to 'dd-MMM-yyyy'
The default Locale is set to Locale.getDefault()
public DateValidator(java.util.Locale locale)
The default mask is set to 'dd-MMM-yyyy'
locale
- Locale, the Locale that is used to
determine months and display monthspublic DateValidator(java.util.Locale locale, java.lang.String mask)
locale
- Locale, the Locale that is used to
determine months and display monthsmask
- String, the mask for displaying the StringMethod Detail |
---|
public boolean verify(javax.swing.JComponent input)
InputValidator
verify
in interface InputValidator
verify
in class javax.swing.InputVerifier
InputVerifier.verify(JComponent)
public java.lang.String getErrorMessage()
InputValidator
getErrorMessage
in interface InputValidator
InputValidator.getErrorMessage()
public java.lang.String getString(java.lang.String txt)
InputValidator
Implementations might differ on what you need the value for.
If you can do with the value with the Mask just use the getText() on which ever field this InputValidator is implemented on.
getString
in interface InputValidator
txt
- String, the Masked text of this Validator
InputValidator.getString(String)
public java.lang.String getString(java.lang.String txt, java.lang.Class c)
InputValidator
Implemenations differ for the implementations of this interface and on which Class is supplied for output. Also not all requested output Classes are implemented for every implementation. on which ever field this InputValidator is implemented on.
getString
in interface InputValidator
txt
- String, the Masked text of this Validatorc
- Class, the type of output you want to return as a String representation
public java.lang.String getLocalizedMessage()
InputValidator
getLocalizedMessage
in interface InputValidator
InputValidator.getLocalizedMessage()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |