API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.text. NumberFormatter View Source
Author(s)
Since
1.4
Version
1.4 03/05/01
Serial
Hierarchy
 Object
      JFormattedTextField.AbstractFormatter
          DefaultFormatter
              InternationalFormatter
                  NumberFormatter
Implements
Subclasses
Description
public class NumberFormatter
  NumberFormatter subclasses InternationalFormatter adding special behavior for numbers.
See also:   
Constructors
public NumberFormatter ()
Creates a NumberFormatter with the a default NumberFormat instance obtained from NumberFormat.getNumberInstance().
public NumberFormatter (NumberFormat format)
  Creates a NumberFormatter with the specified Format instance.
Methods
Hide/Show inherited methods
pack-private Object adjustValue (Object value, Map attributes, Object field, int direction) throws BadLocationException ParseException [Inherited From InternationalFormatter]
  Subclasses supporting incrementing must override this to handle the actual incrementing.
pack-private boolean canIncrement (Object field, int cursorPosition) [Inherited From InternationalFormatter]
  Returns true if field is non-null.
pack-private boolean canReplace (ReplaceHolder rh) [Inherited From InternationalFormatter]
  Overriden in an attempt to honor the literals.
public Object clone () throws CloneNotSupportedException [Inherited From InternationalFormatter]
  Creates a copy of the DefaultFormatter.
pack-private void commitEdit () throws ParseException [Inherited From DefaultFormatter]
Invokes commitEdit on the JFormattedTextField.
protected Action getActions () [Inherited From InternationalFormatter]
If getSupportsIncrement returns true, this returns two Actions suitable for incrementing/decrementing the value.
pack-private Object getAdjustField (int start, Map attributes) [Inherited From InternationalFormatter]
Returns the field that will be adjusted by adjustValue.
public boolean getAllowsInvalid () [Inherited From DefaultFormatter]
  Returns whether or not the value being edited is allowed to be invalid for a length of time.
pack-private Map getAttributes (int index) [Inherited From InternationalFormatter]
Returns a Set of the attribute identifiers at index.
pack-private int getAttributeStart (Attribute id) [Inherited From InternationalFormatter]
  Returns the start of the first run that contains the attribute id.
pack-private char getBufferedChar (int index) [Inherited From InternationalFormatter]
Returns the character from the mask that has been buffered at index.
public boolean getCommitsOnValidEdit () [Inherited From DefaultFormatter]
  Returns when edits are published back to the JFormattedTextField.
protected DocumentFilter getDocumentFilter () [Inherited From DefaultFormatter]
  Returns the DocumentFilter used to restrict the characters that can be input into the JFormattedTextField.
public Field getFields (int offset) [Inherited From InternationalFormatter]
  Returns the Format.Field constants associated with the text at offset.
public Format getFormat () [Inherited From InternationalFormatter]
  Returns the format that dictates the legal values that can be edited and displayed.
protected JFormattedTextField getFormattedTextField () [Inherited From JFormattedTextField.AbstractFormatter]
  Returns the current JFormattedTextField the AbstractFormatter is installed on.
pack-private int getInitialVisualPosition () [Inherited From DefaultFormatter]
  Returns the initial location to position the cursor at.
pack-private AttributedCharacterIterator getIterator () [Inherited From InternationalFormatter]
Returns the AttributedCharacterIterator used to format the last value.
pack-private char getLiteral (int index) [Inherited From InternationalFormatter]
Returns the literal character at index.
pack-private int getLiteralCountTo (int index) [Inherited From InternationalFormatter]
Returns the number of literal characters before index.
public Comparable getMaximum () [Inherited From InternationalFormatter]
  Returns the maximum permissible value.
public Comparable getMinimum () [Inherited From InternationalFormatter]
  Returns the minimum permissible value.
protected NavigationFilter getNavigationFilter () [Inherited From DefaultFormatter]
  Returns the NavigationFilter used to restrict where the cursor can be placed.
pack-private int getNextCursorPosition (int offset, int direction) [Inherited From DefaultFormatter]
  Returns the next cursor position from offset by incrementing direction.
pack-private int getNextVisualPositionFrom (JTextComponent text, int pos, Bias bias, int direction, Bias biasRet) throws BadLocationException [Inherited From DefaultFormatter]
Finds the next navigatable character.
public boolean getOverwriteMode () [Inherited From DefaultFormatter]
  Returns the behavior when inserting characters.
pack-private ReplaceHolder getReplaceHolder (FilterBypass fb, int offset, int length, String text, AttributeSet attrs) [Inherited From InternationalFormatter]
Overriden to return an instance of ExtendedReplaceHolder.
pack-private String getReplaceString (int offset, int deleteLength, String replaceString) [Inherited From DefaultFormatter]
A convenience methods to return the result of deleting deleteLength characters at offset and inserting replaceString at offset in the current text field.
pack-private boolean getSupportsIncrement () [Inherited From InternationalFormatter]
  Returns false, indicating InternationalFormatter does not allow incrementing of the value.
public Class<Object> getValueClass () [Inherited From DefaultFormatter]
  Returns that class that is used to create new Objects.
public void install (JFormattedTextField ftf) [Inherited From InternationalFormatter]
  Installs the DefaultFormatter onto a particular JFormattedTextField.
protected void invalidEdit () [Inherited From JFormattedTextField.AbstractFormatter]
  This should be invoked when the user types an invalid character.
pack-private boolean isLegalInsertText (String text) [Overrides DefaultFormatter]
Subclassed to return false if text contains in an invalid character to insert, that is, it is not a digit (Character.isDigit()) and not one of the characters defined by the DecimalFormatSymbols.
pack-private boolean isLiteral (int index) [Inherited From InternationalFormatter]
Returns true if the character at index is a literal, that is not editable.
pack-private boolean isLiteral (Map attrs) [Overrides InternationalFormatter]
Subclassed to treat the decimal separator, grouping separator, exponent symbol, percent, permille, currency and sign as literals.
pack-private boolean isNavigatable (int index) [Overrides InternationalFormatter]
Subclassed to make the decimal separator navigatable, as well as making the character between the integer field and the next field navigatable.
pack-private boolean isValidEdit (ReplaceHolder rh) [Inherited From DefaultFormatter]
pack-private boolean isValidMask () [Inherited From InternationalFormatter]
Returns true if the current mask is valid.
pack-private boolean isValidValue (Object value, boolean wantsCCE) [Inherited From InternationalFormatter]
  Returns true if value is between the min/max.
pack-private void moveDot (FilterBypass fb, int dot, Bias bias) [Inherited From DefaultFormatter]
NavigationFilter method, subclasses that wish finer control should override this.
pack-private void positionCursorAtInitialLocation () [Inherited From DefaultFormatter]
Positions the cursor at the initial location.
pack-private boolean replace (ReplaceHolder rh) throws BadLocationException [Inherited From InternationalFormatter]
  When in !allowsInvalid mode the text is reset on every edit, thus supers implementation will position the cursor at the wrong position.
pack-private void replace (FilterBypass fb, int offset, int length, String string, AttributeSet attr) throws BadLocationException [Overrides InternationalFormatter]
Overriden to toggle the value if the positive/minus sign is inserted.
pack-private void repositionCursor (int offset, int direction) [Inherited From DefaultFormatter]
Resets the cursor by using getNextCursorPosition.
pack-private void resetValue (Object value) throws BadLocationException ParseException [Inherited From InternationalFormatter]
Resets the value of the JFormattedTextField to be value.
pack-private void selectField (Object f, int count) [Inherited From InternationalFormatter]
Selects the fields identified by attributes.
public void setAllowsInvalid (boolean allowsInvalid) [Inherited From DefaultFormatter]
  Sets whether or not the value being edited is allowed to be invalid for a length of time (that is, stringToValue throws a ParseException).
public void setCommitsOnValidEdit (boolean commit) [Inherited From DefaultFormatter]
  Sets when edits are published back to the JFormattedTextField.
pack-private void setDot (FilterBypass fb, int dot, Bias bias) [Inherited From DefaultFormatter]
NavigationFilter method, subclasses that wish finer control should override this.
protected void setEditValid (boolean valid) [Inherited From JFormattedTextField.AbstractFormatter]
  Invoke this to update the editValid property of the JFormattedTextField.
public void setFormat (Format format) [Overrides InternationalFormatter]
  Sets the format that dictates the legal values that can be edited and displayed.
public void setMaximum (Comparable max) [Inherited From InternationalFormatter]
  Sets the maximum permissible value.
public void setMinimum (Comparable minimum) [Inherited From InternationalFormatter]
  Sets the minimum permissible value.
public void setOverwriteMode (boolean overwriteMode) [Inherited From DefaultFormatter]
  Configures the behavior when inserting characters.
public void setValueClass (Class<Object> valueClass) [Inherited From DefaultFormatter]
  Sets that class that is used to create new Objects.
public Object stringToValue (String text) throws ParseException [Inherited From InternationalFormatter] [Specified in JFormattedTextField.AbstractFormatter]
  Returns the Object representation of the String text.
pack-private Object stringToValue (String text, Format f) throws ParseException [Overrides InternationalFormatter]
Invokes parseObject on f, returning its value.
public void uninstall () [Inherited From JFormattedTextField.AbstractFormatter]
  Uninstalls any state the AbstractFormatter may have installed on the JFormattedTextField.
pack-private void updateMask () [Inherited From InternationalFormatter]
  Updates the AttributedCharacterIterator by invoking formatToCharacterIterator on the Format.
pack-private void updateMaskIfNecessary () [Inherited From InternationalFormatter]
Updates the AttributedCharacterIterator and bitset, if necessary.
pack-private void updateValue () [Inherited From DefaultFormatter]
Pushes the value to the JFormattedTextField if the current value is valid and invokes setEditValid based on the validity of the value.
pack-private void updateValue (Object value) [Inherited From InternationalFormatter]
Overriden to update the mask after invoking supers implementation.
public String valueToString (Object value) throws ParseException [Inherited From InternationalFormatter] [Specified in JFormattedTextField.AbstractFormatter]
  Returns a String representation of the Object value.
Fields
Hide/Show inherited fields
pack-privatetransient ReplaceHolder replaceHolder [Inherited From DefaultFormatter]
Used during replace to track the region to replace.
Nested Classes
  InternationalFormatter.ExtendedReplaceHolder
As InternationalFormatter replaces the complete text on every edit, ExtendedReplaceHolder keeps track of the offset and length passed into canReplace.
  DefaultFormatter.ReplaceHolder
ReplaceHolder is used to track where insert/remove/replace is going to happen.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar