Class TextFormatter<V>

java.lang.Object
javafx.scene.control.TextFormatter<V>
Type Parameters:
V - The type of the value

public class TextFormatter<V> extends Object
A Formatter describes a format of a TextInputControl text by using two distinct mechanisms:
  • A filter (getFilter()) that can intercept and modify user input. This helps to keep the text in the desired format. A default text supplier can be used to provide the initial text.
  • A value converter (getValueConverter()) and value (valueProperty()) can be used to provide special format that represents a value of type V. If the control is editable and the text is changed by the user, the value is then updated to correspond to the text.

It's possible to have a formatter with just a filter or a value converter. If a value converter is not provided, setting a value will result in an IllegalStateException and the value is always null.

Since Formatter contains a value that represents the state of the TextInputControl to which it is currently assigned, a single Formatter instance can be used only in one TextInputControl at a time.

Since:
JavaFX 8u40