|
JHotDraw 7.3.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.JFormattedTextField.AbstractFormatter
javax.swing.text.DefaultFormatter
org.jhotdraw.text.JavaNumberFormatter
public class JavaNumberFormatter
ScaledNumberFormatter is used to format numbers written in the
Java programming syntax.
| Constructor Summary | |
|---|---|
JavaNumberFormatter()
Creates a NumberFormatter with the a default
NumberFormat instance obtained from
NumberFormat.getNumberInstance(). |
|
JavaNumberFormatter(double min,
double max,
double scaleFactor)
Creates a NumberFormatter with the specified Format instance. |
|
JavaNumberFormatter(double min,
double max,
double scaleFactor,
boolean allowsNullValue,
boolean appendsDotZero)
Creates a NumberFormatter with the specified Format instance. |
|
| Method Summary | |
|---|---|
static javax.swing.JFormattedTextField.AbstractFormatterFactory |
createFormatterFactory(double min,
double max,
double scaleFactor)
Convenience method for creating a formatter factory with a ScalableNumberFormatter and a Java-style DecimalFormat. |
static javax.swing.JFormattedTextField.AbstractFormatterFactory |
createFormatterFactory(double min,
double max,
double scaleFactor,
boolean allowsNullValue,
boolean appendsDotZero)
Convenience method for creating a formatter factory with a ScalableNumberFormatter and a Java-style DecimalFormat. |
boolean |
getAllowsNullValue()
Returns true if null values are allowed. |
boolean |
getAppendsDotZero()
Returns true if null values are allowed. |
java.lang.Comparable |
getMaximum()
Returns the maximum permissible value. |
java.lang.Comparable |
getMinimum()
Returns the minimum permissible value. |
double |
getScaleFactor()
Returns the scale factor of the number formatter. |
void |
setAllowsNullValue(boolean newValue)
Allows/Disallows null values. |
void |
setAppendsDotZero(boolean newValue)
Specifies whether ".0" is appended to double and float values. |
void |
setMaximum(java.lang.Comparable max)
Sets the maximum permissible value. |
void |
setMinimum(java.lang.Comparable minimum)
Sets the minimum permissible value. |
void |
setScaleFactor(double newValue)
Changes the scale factor of the number formatter. |
java.lang.Object |
stringToValue(java.lang.String text)
Returns the Object representation of the
String text. |
java.lang.String |
valueToString(java.lang.Object value)
Returns a String representation of the Object value. |
| Methods inherited from class javax.swing.text.DefaultFormatter |
|---|
clone, getAllowsInvalid, getCommitsOnValidEdit, getDocumentFilter, getNavigationFilter, getOverwriteMode, getValueClass, install, setAllowsInvalid, setCommitsOnValidEdit, setOverwriteMode, setValueClass |
| Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatter |
|---|
getActions, getFormattedTextField, invalidEdit, setEditValid, uninstall |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JavaNumberFormatter()
NumberFormatter with the a default
NumberFormat instance obtained from
NumberFormat.getNumberInstance().
public JavaNumberFormatter(double min,
double max,
double scaleFactor)
public JavaNumberFormatter(double min,
double max,
double scaleFactor,
boolean allowsNullValue,
boolean appendsDotZero)
| Method Detail |
|---|
public void setMinimum(java.lang.Comparable minimum)
valueClass has
not been specified, and minimum is non null, the
valueClass will be set to that of the class of
minimum.
minimum - Minimum legal value that can be inputDefaultFormatter.setValueClass(java.lang.Class>)public java.lang.Comparable getMinimum()
public void setMaximum(java.lang.Comparable max)
valueClass has
not been specified, and max is non null, the
valueClass will be set to that of the class of
max.
max - Maximum legal value that can be inputDefaultFormatter.setValueClass(java.lang.Class>)public java.lang.Comparable getMaximum()
public void setScaleFactor(double newValue)
newValue - public double getScaleFactor()
public void setAllowsNullValue(boolean newValue)
newValue - public boolean getAllowsNullValue()
public void setAppendsDotZero(boolean newValue)
newValue - public boolean getAppendsDotZero()
public java.lang.String valueToString(java.lang.Object value)
throws java.text.ParseException
value.
This invokes format on the current Format.
valueToString in class javax.swing.text.DefaultFormattervalue - Value to convert
java.text.ParseException - if there is an error in the conversion
public java.lang.Object stringToValue(java.lang.String text)
throws java.text.ParseException
Object representation of the
String text.
stringToValue in class javax.swing.text.DefaultFormattertext - String to convert
Object representation of text
java.text.ParseException - if there is an error in the conversion
public static javax.swing.JFormattedTextField.AbstractFormatterFactory createFormatterFactory(double min,
double max,
double scaleFactor)
ScalableNumberFormatter and a Java-style DecimalFormat.
Doesn't allow null values and doesn't append ".0" to double and float values.
public static javax.swing.JFormattedTextField.AbstractFormatterFactory createFormatterFactory(double min,
double max,
double scaleFactor,
boolean allowsNullValue,
boolean appendsDotZero)
ScalableNumberFormatter and a Java-style DecimalFormat.
|
Copyright 1996-2009 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||