Class Overview
DateFormatter is an InternationalFormatter
that does its
formatting by way of an instance of java.text.DateFormat
.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see XMLEncoder
.
Summary
Public Constructors |
|
DateFormatter()
This is shorthand for
new DateFormatter(DateFormat.getDateInstance()) .
|
|
DateFormatter(DateFormat format)
Returns a DateFormatter configured with the specified
Format instance.
|
Public Methods |
void
|
setFormat(DateFormat format)
Sets the format that dictates the legal values that can be edited
and displayed.
|
[Expand]
Inherited Methods |
From class
javax.swing.text.InternationalFormatter
|
From class
javax.swing.text.DefaultFormatter
Object
|
clone()
Creates a copy of the DefaultFormatter.
|
boolean
|
getAllowsInvalid()
Returns whether or not the value being edited is allowed to be invalid
for a length of time.
|
boolean
|
getCommitsOnValidEdit()
Returns when edits are published back to the
JFormattedTextField .
|
DocumentFilter
|
getDocumentFilter()
Returns the DocumentFilter used to restrict the characters
that can be input into the JFormattedTextField .
|
NavigationFilter
|
getNavigationFilter()
Returns the NavigationFilter used to restrict where the
cursor can be placed.
|
boolean
|
getOverwriteMode()
Returns the behavior when inserting characters.
|
Class<?>
|
getValueClass()
Returns that class that is used to create new Objects.
|
void
|
install(JFormattedTextField ftf)
Installs the DefaultFormatter onto a particular
JFormattedTextField .
|
void
|
setAllowsInvalid(boolean allowsInvalid)
Sets whether or not the value being edited is allowed to be invalid
for a length of time (that is, stringToValue throws
a ParseException ).
|
void
|
setCommitsOnValidEdit(boolean commit)
Sets when edits are published back to the
JFormattedTextField .
|
void
|
setOverwriteMode(boolean overwriteMode)
Configures the behavior when inserting characters.
|
void
|
setValueClass(Class<?> valueClass)
Sets that class that is used to create new Objects.
|
Object
|
stringToValue(String string)
Converts the passed in String into an instance of
getValueClass by way of the constructor that
takes a String argument.
|
String
|
valueToString(Object value)
Converts the passed in Object into a String by way of the
toString method.
|
|
From class
javax.swing.JFormattedTextField.AbstractFormatter
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
Public Constructors
public
DateFormatter
()
This is shorthand for
new DateFormatter(DateFormat.getDateInstance())
.
public
DateFormatter
(DateFormat format)
Returns a DateFormatter configured with the specified
Format
instance.
Parameters
format
| Format used to dictate legal values
|
Public Methods
public
void
setFormat
(DateFormat format)
Sets the format that dictates the legal values that can be edited
and displayed.
If you have used the nullary constructor the value of this property
will be determined for the current locale by way of the
Dateformat.getDateInstance()
method.
Parameters
format
| DateFormat instance used for converting from/to Strings
|