API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.text. DefaultFormatter View Source
Author(s)
Since
1.4
Version
1.14 11/17/05
Serial
Hierarchy
 Object
      JFormattedTextField.AbstractFormatter
          DefaultFormatter
Implements
 Cloneable
 Serializable
Subclasses
Description
public class DefaultFormatter
  DefaultFormatter formats aribtrary objects.
Constructors
public DefaultFormatter ()
Creates a DefaultFormatter.
Methods
Hide/Show inherited methods
pack-private boolean canReplace (ReplaceHolder rh)
Returns true if the edit described by rh will result in a legal value.
public Object clone () throws CloneNotSupportedException [Overrides JFormattedTextField.AbstractFormatter]
  Creates a copy of the DefaultFormatter.
pack-private void commitEdit () throws ParseException
Invokes commitEdit on the JFormattedTextField.
protected Action getActions () [Inherited From JFormattedTextField.AbstractFormatter]
  Subclass and override if you wish to provide a custom set of Actions.
public boolean getAllowsInvalid ()
  Returns whether or not the value being edited is allowed to be invalid for a length of time.
public boolean getCommitsOnValidEdit ()
  Returns when edits are published back to the JFormattedTextField.
protected DocumentFilter getDocumentFilter () [Overrides JFormattedTextField.AbstractFormatter]
  Returns the DocumentFilter used to restrict the characters that can be input into the JFormattedTextField.
protected JFormattedTextField getFormattedTextField () [Inherited From JFormattedTextField.AbstractFormatter]
  Returns the current JFormattedTextField the AbstractFormatter is installed on.
pack-private int getInitialVisualPosition ()
  Returns the initial location to position the cursor at.
protected NavigationFilter getNavigationFilter () [Overrides JFormattedTextField.AbstractFormatter]
  Returns the NavigationFilter used to restrict where the cursor can be placed.
pack-private int getNextCursorPosition (int offset, int direction)
  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
Finds the next navigatable character.
public boolean getOverwriteMode ()
  Returns the behavior when inserting characters.
pack-private ReplaceHolder getReplaceHolder (FilterBypass fb, int offset, int length, String text, AttributeSet attrs)
Returns the ReplaceHolder to track the replace of the specified text.
pack-private String getReplaceString (int offset, int deleteLength, String replaceString)
A convenience methods to return the result of deleting deleteLength characters at offset and inserting replaceString at offset in the current text field.
public Class<Object> getValueClass ()
  Returns that class that is used to create new Objects.
public void install (JFormattedTextField ftf) [Overrides JFormattedTextField.AbstractFormatter]
  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)
  Returns true if the text in text can be inserted.
pack-private boolean isNavigatable (int offset)
  Subclasses should override this if they want cursor navigation to skip certain characters.
pack-private boolean isValidEdit (ReplaceHolder rh)
pack-private void moveDot (FilterBypass fb, int dot, Bias bias)
NavigationFilter method, subclasses that wish finer control should override this.
pack-private void positionCursorAtInitialLocation ()
Positions the cursor at the initial location.
pack-private boolean replace (ReplaceHolder rh) throws BadLocationException
  If the edit described by rh is legal, this will return true, commit the edit (if necessary) and update the cursor position.
pack-private void replace (FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException
DocumentFilter method, funnels into replace.
pack-private void repositionCursor (int offset, int direction)
Resets the cursor by using getNextCursorPosition.
public void setAllowsInvalid (boolean allowsInvalid)
  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)
  Sets when edits are published back to the JFormattedTextField.
pack-private void setDot (FilterBypass fb, int dot, Bias bias)
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 setOverwriteMode (boolean overwriteMode)
  Configures the behavior when inserting characters.
public void setValueClass (Class<Object> valueClass)
  Sets that class that is used to create new Objects.
public Object stringToValue (String string) throws ParseException [Specified in JFormattedTextField.AbstractFormatter]
  Converts the passed in String into an instance of getValueClass by way of the constructor that takes a String argument.
public void uninstall () [Inherited From JFormattedTextField.AbstractFormatter]
  Uninstalls any state the AbstractFormatter may have installed on the JFormattedTextField.
pack-private void updateValue ()
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)
  Pushes the value to the editor if we are to commit on edits.
public String valueToString (Object value) throws ParseException [Specified in JFormattedTextField.AbstractFormatter]
  Converts the passed in Object into a String by way of the toString method.
Fields
Hide/Show inherited fields
pack-privatetransient ReplaceHolder replaceHolder
Used during replace to track the region to replace.
Nested Classes
  DefaultFormatter.ReplaceHolder
ReplaceHolder is used to track where insert/remove/replace is going to happen.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar