33 import javax.swing.*;
34
35 /**
36 * <code>DefaultFormatter</code> formats arbitrary objects. Formatting is done
37 * by invoking the <code>toString</code> method. In order to convert the
38 * value back to a String, your class must provide a constructor that
39 * takes a String argument. If no single argument constructor that takes a
40 * String is found, the returned value will be the String passed into
41 * <code>stringToValue</code>.
42 * <p>
43 * Instances of <code>DefaultFormatter</code> can not be used in multiple
44 * instances of <code>JFormattedTextField</code>. To obtain a copy of
45 * an already configured <code>DefaultFormatter</code>, use the
46 * <code>clone</code> method.
47 * <p>
48 * <strong>Warning:</strong>
49 * Serialized objects of this class will not be compatible with
50 * future Swing releases. The current serialization support is
51 * appropriate for short term storage or RMI between applications running
52 * the same version of Swing. As of 1.4, support for long term storage
53 * of all JavaBeans™
54 * has been added to the <code>java.beans</code> package.
55 * Please see {@link java.beans.XMLEncoder}.
56 *
57 * @see javax.swing.JFormattedTextField.AbstractFormatter
58 *
59 * @since 1.4
60 */
61 @SuppressWarnings("serial") // Same-version serialization only
62 public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
63 implements Cloneable, Serializable {
64 /** Indicates if the value being edited must match the mask. */
65 private boolean allowsInvalid;
66
67 /** If true, editing mode is in overwrite (or strikethough). */
68 private boolean overwriteMode;
69
70 /** If true, any time a valid edit happens commitEdit is invoked. */
71 private boolean commitOnEdit;
72
73 /** Class used to create new instances. */
|
33 import javax.swing.*;
34
35 /**
36 * <code>DefaultFormatter</code> formats arbitrary objects. Formatting is done
37 * by invoking the <code>toString</code> method. In order to convert the
38 * value back to a String, your class must provide a constructor that
39 * takes a String argument. If no single argument constructor that takes a
40 * String is found, the returned value will be the String passed into
41 * <code>stringToValue</code>.
42 * <p>
43 * Instances of <code>DefaultFormatter</code> can not be used in multiple
44 * instances of <code>JFormattedTextField</code>. To obtain a copy of
45 * an already configured <code>DefaultFormatter</code>, use the
46 * <code>clone</code> method.
47 * <p>
48 * <strong>Warning:</strong>
49 * Serialized objects of this class will not be compatible with
50 * future Swing releases. The current serialization support is
51 * appropriate for short term storage or RMI between applications running
52 * the same version of Swing. As of 1.4, support for long term storage
53 * of all JavaBeans
54 * has been added to the <code>java.beans</code> package.
55 * Please see {@link java.beans.XMLEncoder}.
56 *
57 * @see javax.swing.JFormattedTextField.AbstractFormatter
58 *
59 * @since 1.4
60 */
61 @SuppressWarnings("serial") // Same-version serialization only
62 public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
63 implements Cloneable, Serializable {
64 /** Indicates if the value being edited must match the mask. */
65 private boolean allowsInvalid;
66
67 /** If true, editing mode is in overwrite (or strikethough). */
68 private boolean overwriteMode;
69
70 /** If true, any time a valid edit happens commitEdit is invoked. */
71 private boolean commitOnEdit;
72
73 /** Class used to create new instances. */
|