Class TextFieldListCell<T>

  • Type Parameters:
    T - The type of the elements contained within the ListView.
    All Implemented Interfaces:
    Styleable, EventTarget, Skinnable

    public class TextFieldListCell<T>
    extends ListCell<T>
    A class containing a ListCell implementation that draws a TextField node inside the cell.

    By default, the TextFieldListCell is rendered as a Label when not being edited, and as a TextField when in editing mode. The TextField will, by default, stretch to fill the entire list cell.

    Since:
    JavaFX 2.2
    • Constructor Detail

      • TextFieldListCell

        public TextFieldListCell()
        Creates a default TextFieldListCell with a null converter. Without a StringConverter specified, this cell will not be able to accept input from the TextField (as it will not know how to convert this back to the domain object). It is therefore strongly encouraged to not use this constructor unless you intend to set the converter separately.
      • TextFieldListCell

        public TextFieldListCell​(StringConverter<T> converter)
        Creates a TextFieldListCell that provides a TextField when put into editing mode that allows editing of the cell content. This method will work on any ListView instance, regardless of its generic type. However, to enable this, a StringConverter must be provided that will convert the given String (from what the user typed in) into an instance of type T. This item will then be passed along to the ListView.onEditCommitProperty() callback.
        Parameters:
        converter - A converter that can convert the given String (from what the user typed in) into an instance of type T.