Class SearchField


public class SearchField extends TextField
A TextField preset for search: a leading magnifier icon inside the field and a trailing coupled clear button (the ComboBox-caret idiom). Enter fires onSubmit; the clear button empties the field.
  • Constructor Details

    • SearchField

      public SearchField()
      A field with a search icon, a clear button and a localized placeholder.
  • Method Details

    • onSubmit

      public SearchField onSubmit(Consumer<String> listener)
      Fires with the current query when Enter is pressed.
    • clear

      public void clear()
      Empties the field (and notifies onChange), as the trailing button does.
    • onKeyEvent

      protected void onKeyEvent(KeyEvent event)
      Description copied from class: Widget
      Key events (focused widget first, then ancestors).
      Overrides:
      onKeyEvent in class TextField