Interface TextComponentBuilder<C extends JTextComponent,T,B extends TextComponentBuilder<C,T,B>>

All Superinterfaces:
ComponentBuilder<C,B>, ComponentValueBuilder<C,T,B>, Supplier<C>
All Known Subinterfaces:
NumberField.Builder<T>, PasswordFieldBuilder, TemporalField.Builder<T>, TextAreaBuilder, TextFieldBuilder<C,T,B>, TextPaneBuilder

public interface TextComponentBuilder<C extends JTextComponent,T,B extends TextComponentBuilder<C,T,B>> extends ComponentValueBuilder<C,T,B>
A builder for text components.
  • Method Details

    • editable

      B editable(boolean editable)
      Parameters:
      editable - false if the component should not be editable
      Returns:
      this builder instance
      See Also:
    • updateOn

      B updateOn(UpdateOn updateOn)
      Parameters:
      updateOn - specifies when the underlying value should be updated
      Returns:
      this builder instance
    • upperCase

      B upperCase(boolean upperCase)
      Parameters:
      upperCase - if true the text component convert all lower case input to upper case
      Returns:
      this builder instance
    • lowerCase

      B lowerCase(boolean lowerCase)
      Parameters:
      lowerCase - if true the text component convert all upper case input to lower case
      Returns:
      this builder instance
    • maximumLength

      B maximumLength(int maximumLength)
      Typing beyond the maximum length is silently rejected, while a longer edit exceeding it, such as a paste or setting the text, throws IllegalArgumentException. Note that length restriction is only supported for String based text components. Builders for fields based on other data types may throw UnsupportedOperationException
      Parameters:
      maximumLength - the maximum text length
      Returns:
      this builder instance
      Throws:
      UnsupportedOperationException - in case the field does not support text length restriction
    • margin

      B margin(@Nullable Insets margin)
      Parameters:
      margin - the margin
      Returns:
      this builder instance
      See Also:
    • controlDeleteWord

      B controlDeleteWord(boolean controlDeleteWord)
      Parameters:
      controlDeleteWord - true if CTRL-DEL and CTRL-BACKSPACE should delete the next/previous word
      Returns:
      this builder instance
    • disabledTextColor

      B disabledTextColor(@Nullable Color disabledTextColor)
      Parameters:
      disabledTextColor - the color used to render disabled text
      Returns:
      this builder instance
      See Also:
    • selectedTextColor

      B selectedTextColor(@Nullable Color selectedTextColor)
      Parameters:
      selectedTextColor - the color used to render selected text
      Returns:
      this builder instance
      See Also:
    • selectionColor

      B selectionColor(@Nullable Color selectionColor)
      Parameters:
      selectionColor - the color used to render selected text background
      Returns:
      this builder instance
      See Also:
    • selectAllOnFocusGained

      B selectAllOnFocusGained(boolean selectAllOnFocusGained)
      Makes the text component select all when it gains focus
      Parameters:
      selectAllOnFocusGained - if true the component will select contents on focus gained
      Returns:
      this builder instance
    • moveCaretToEndOnFocusGained

      B moveCaretToEndOnFocusGained(boolean moveCaretToEndOnFocusGained)
      Parameters:
      moveCaretToEndOnFocusGained - true if the caret should be moved to the end on focus gained
      Returns:
      this builder instance
    • moveCaretToStartOnFocusGained

      B moveCaretToStartOnFocusGained(boolean moveCaretToStartOnFocusGained)
      Parameters:
      moveCaretToStartOnFocusGained - true if the caret should be moved to the start on focus gained
      Returns:
      this builder instance
    • caretListener

      B caretListener(CaretListener caretListener)
      Parameters:
      caretListener - the caret listener to add
      Returns:
      this builder instance
    • documentListener

      B documentListener(Function<C,DocumentListener> documentListener)
      Adds a document listener to the underlying document.
      Parameters:
      documentListener - a function providing a document listener, receives the text component
      Returns:
      this builder instance
      See Also:
    • dragEnabled

      B dragEnabled(boolean dragEnabled)
      Parameters:
      dragEnabled - true if automatic drag handling should be enabled
      Returns:
      this builder instance
      See Also:
    • focusAccelerator

      B focusAccelerator(char focusAcceleratorKey)
      Parameters:
      focusAcceleratorKey - the focus accelerator key
      Returns:
      this builder instance
      See Also:
    • caretPosition

      B caretPosition(TextComponentBuilder.CaretPosition caretPosition)
      Specifies the initial caret position for the component in case an initial value is specified. Default TextComponentBuilder.CaretPosition.START
      Parameters:
      caretPosition - the initial caret position
      Returns:
      this builder instance
      See Also:
    • caretUpdatePolicy

      B caretUpdatePolicy(int caretUpdatePolicy)
      Parameters:
      caretUpdatePolicy - the caret update policy
      Returns:
      this builder instance
      See Also: