68 * of <code>Integer</code>, <code>Long</code>, <code>Float</code>,
69 * <code>Double</code>, <code>Byte</code> or <code>Short</code> and
70 * the Format's <code>parseObject</code> returns an instance of
71 * <code>Number</code>, the corresponding instance of the value class
72 * will be created using the constructor appropriate for the primitive
73 * type the value class represents. For example:
74 * <code>setValueClass(Integer.class)</code> will cause the resulting
75 * value to be created via
76 * <code>Integer.valueOf(((Number)formatter.parseObject(string)).intValue())</code>.
77 * This is typically useful if you
78 * wish to set a min/max value as the various <code>Number</code>
79 * implementations are generally not comparable to each other. This is also
80 * useful if for some reason you need a specific <code>Number</code>
81 * implementation for your values.
82 * <p>
83 * <strong>Warning:</strong>
84 * Serialized objects of this class will not be compatible with
85 * future Swing releases. The current serialization support is
86 * appropriate for short term storage or RMI between applications running
87 * the same version of Swing. As of 1.4, support for long term storage
88 * of all JavaBeans™
89 * has been added to the <code>java.beans</code> package.
90 * Please see {@link java.beans.XMLEncoder}.
91 *
92 * @since 1.4
93 */
94 @SuppressWarnings("serial") // Same-version serialization only
95 public class NumberFormatter extends InternationalFormatter {
96 /** The special characters from the Format instance. */
97 private String specialChars;
98
99 /**
100 * Creates a <code>NumberFormatter</code> with the a default
101 * <code>NumberFormat</code> instance obtained from
102 * <code>NumberFormat.getNumberInstance()</code>.
103 */
104 public NumberFormatter() {
105 this(NumberFormat.getNumberInstance());
106 }
107
108 /**
|
68 * of <code>Integer</code>, <code>Long</code>, <code>Float</code>,
69 * <code>Double</code>, <code>Byte</code> or <code>Short</code> and
70 * the Format's <code>parseObject</code> returns an instance of
71 * <code>Number</code>, the corresponding instance of the value class
72 * will be created using the constructor appropriate for the primitive
73 * type the value class represents. For example:
74 * <code>setValueClass(Integer.class)</code> will cause the resulting
75 * value to be created via
76 * <code>Integer.valueOf(((Number)formatter.parseObject(string)).intValue())</code>.
77 * This is typically useful if you
78 * wish to set a min/max value as the various <code>Number</code>
79 * implementations are generally not comparable to each other. This is also
80 * useful if for some reason you need a specific <code>Number</code>
81 * implementation for your values.
82 * <p>
83 * <strong>Warning:</strong>
84 * Serialized objects of this class will not be compatible with
85 * future Swing releases. The current serialization support is
86 * appropriate for short term storage or RMI between applications running
87 * the same version of Swing. As of 1.4, support for long term storage
88 * of all JavaBeans
89 * has been added to the <code>java.beans</code> package.
90 * Please see {@link java.beans.XMLEncoder}.
91 *
92 * @since 1.4
93 */
94 @SuppressWarnings("serial") // Same-version serialization only
95 public class NumberFormatter extends InternationalFormatter {
96 /** The special characters from the Format instance. */
97 private String specialChars;
98
99 /**
100 * Creates a <code>NumberFormatter</code> with the a default
101 * <code>NumberFormat</code> instance obtained from
102 * <code>NumberFormat.getNumberInstance()</code>.
103 */
104 public NumberFormatter() {
105 this(NumberFormat.getNumberInstance());
106 }
107
108 /**
|