< prev index next >
src/java.desktop/share/classes/javax/swing/text/DateFormatter.java
Print this page
*** 29,67 ****
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
/**
! * DateFormatter is an <code>InternationalFormatter</code> that does its
! * formatting by way of an instance of <code>java.text.DateFormat</code>.
* <p>
* <strong>Warning:</strong>
* 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 JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see java.text.DateFormat
*
* @since 1.4
*/
@SuppressWarnings("serial") // Same-version serialization only
public class DateFormatter extends InternationalFormatter {
/**
* This is shorthand for
! * <code>new DateFormatter(DateFormat.getDateInstance())</code>.
*/
public DateFormatter() {
this(DateFormat.getDateInstance());
}
/**
* Returns a DateFormatter configured with the specified
! * <code>Format</code> instance.
*
* @param format Format used to dictate legal values
*/
public DateFormatter(DateFormat format) {
super(format);
--- 29,67 ----
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
/**
! * DateFormatter is an {@code InternationalFormatter} that does its
! * formatting by way of an instance of {@code java.text.DateFormat}.
* <p>
* <strong>Warning:</strong>
* 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 JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see java.text.DateFormat
*
* @since 1.4
*/
@SuppressWarnings("serial") // Same-version serialization only
public class DateFormatter extends InternationalFormatter {
/**
* This is shorthand for
! * {@code new DateFormatter(DateFormat.getDateInstance())}.
*/
public DateFormatter() {
this(DateFormat.getDateInstance());
}
/**
* Returns a DateFormatter configured with the specified
! * {@code Format} instance.
*
* @param format Format used to dictate legal values
*/
public DateFormatter(DateFormat format) {
super(format);
*** 72,93 ****
* Sets the format that dictates the legal values that can be edited
* and displayed.
* <p>
* If you have used the nullary constructor the value of this property
* will be determined for the current locale by way of the
! * <code>Dateformat.getDateInstance()</code> method.
*
* @param format DateFormat instance used for converting from/to Strings
*/
public void setFormat(DateFormat format) {
super.setFormat(format);
}
/**
! * Returns the Calendar that <code>DateFormat</code> is associated with,
! * or if the <code>Format</code> is not a <code>DateFormat</code>
! * <code>Calendar.getInstance</code> is returned.
*/
private Calendar getCalendar() {
Format f = getFormat();
if (f instanceof DateFormat) {
--- 72,93 ----
* Sets the format that dictates the legal values that can be edited
* and displayed.
* <p>
* If you have used the nullary constructor the value of this property
* will be determined for the current locale by way of the
! * {@code Dateformat.getDateInstance()} method.
*
* @param format DateFormat instance used for converting from/to Strings
*/
public void setFormat(DateFormat format) {
super.setFormat(format);
}
/**
! * Returns the Calendar that {@code DateFormat} is associated with,
! * or if the {@code Format} is not a {@code DateFormat}
! * {@code Calendar.getInstance} is returned.
*/
private Calendar getCalendar() {
Format f = getFormat();
if (f instanceof DateFormat) {
< prev index next >