Interface ComboBoxBuilder<C extends JComboBox<T>,T,B extends ComboBoxBuilder<C,T,B>>

Type Parameters:
C - the component type
T - the value type
B - the builder type
All Superinterfaces:
ComponentBuilder<C,B>, ComponentValueBuilder<C,T,B>, Supplier<C>
All Known Subinterfaces:
EntityComboBox.Builder
All Known Implementing Classes:
DefaultComboBoxBuilder

public interface ComboBoxBuilder<C extends JComboBox<T>,T,B extends ComboBoxBuilder<C,T,B>> extends ComponentValueBuilder<C,T,B>
Builds a JComboBox.
  • Field Details

    • MOUSE_WHEEL_SCROLLING

      static final PropertyValue<Boolean> MOUSE_WHEEL_SCROLLING
      Specifies whether mouse wheel scrolling is enabled in combo boxes by default.
      • Value type:Boolean
      • Default value: true
  • Method Details

    • editable

      B editable(boolean editable)
      Parameters:
      editable - specifies whether the combo box should be editable
      Returns:
      this builder instance
      See Also:
    • completionMode

      B completionMode(Completion.Mode completionMode)
      Parameters:
      completionMode - the completion mode
      Returns:
      this builder instance
    • normalize

      B normalize(boolean normalize)
      Specifies whether to normalize strings during auto-completion
      Parameters:
      normalize - true if strings should be normalized during autocomplete
      Returns:
      this builder instance
      See Also:
    • renderer

      B renderer(@Nullable ListCellRenderer<? super T> renderer)
      Parameters:
      renderer - the renderer for the combo box
      Returns:
      this builder instance
      See Also:
    • editor

      B editor(@Nullable ComboBoxEditor editor)
      Parameters:
      editor - the editor for the combo box
      Returns:
      this builder instance
      See Also:
    • mouseWheelScrolling

      B mouseWheelScrolling(boolean mouseWheelScrolling)
      Enable mouse wheel scrolling on the combo box
      Parameters:
      mouseWheelScrolling - true if mouse wheel scrolling should be enabled
      Returns:
      this builder instance
      See Also:
    • mouseWheelScrollingWithWrapAround

      B mouseWheelScrollingWithWrapAround(boolean mouseWheelScrollingWithWrapAround)
      Enable mouse wheel scrolling on the combo box, with wrap around
      Parameters:
      mouseWheelScrollingWithWrapAround - true if mouse wheel scrolling with wrap around should be enabled
      Returns:
      this builder instance
    • maximumRowCount

      B maximumRowCount(int maximumRowCount)
      Parameters:
      maximumRowCount - the maximum row count before a scroll bar is shown
      Returns:
      this builder instance
      See Also:
    • moveCaretToFrontOnSelection

      B moveCaretToFrontOnSelection(boolean moveCaretToFrontOnSelection)
      When a JComboBox is editable, and a long item is selected, the caret is moved to the end, hiding the start of the selected item. Enabling this moves the caret to the front on selection, thereby showing the start of the selected item. Note that this only works in conjunction with a SwingFilterComboBoxModel. This is enabled by default.
      Parameters:
      moveCaretToFrontOnSelection - if true the caret is moved to the front of the editor component on selection, displaying the start of the selected item, instead of the end
      Returns:
      this builder instance
    • popupWidth

      B popupWidth(int popupWidth)
      Only applicable for the system and cross-platform Look and Feels.
      Parameters:
      popupWidth - a fixed popup width
      Returns:
      this builder instance
    • itemListener

      B itemListener(ItemListener itemListener)
      Parameters:
      itemListener - the item listener
      Returns:
      this builder instance
      See Also:
    • enterAction

      B enterAction(Action action)
      Adds an action for Enter, consulted after the ones already added, see addEnterAction(JComboBox, Action). Note that this disables ComponentBuilder.transferFocusOnEnter(boolean), which would otherwise take the Enter key.
      Parameters:
      action - the action
      Returns:
      this builder instance
    • builder

      static ComboBoxBuilder.ModelStep builder()
      Returns:
      a ComboBoxBuilder.ModelStep
    • enableMouseWheelSelection

      static void enableMouseWheelSelection(JComboBox<?> comboBox)
      Enables mouse wheel selection for the given combo box
      Parameters:
      comboBox - the combo box
    • enableMouseWheelSelectionWithWrapAround

      static void enableMouseWheelSelectionWithWrapAround(JComboBox<?> comboBox)
      Enables mouse wheel selection for the given combo box with wrap around
      Parameters:
      comboBox - the combo box
    • addEnterAction

      static void addEnterAction(JComboBox<?> comboBox, Action action)

      Adds an action for Enter to the given combo box, consulted after the ones already added.

      While the popup is visible, Enter is the look and feel's, selecting and closing. Otherwise the first enabled action, in the order added, is performed, once the combo box has committed its editor, and with none enabled Enter is the look and feel's, the default button. With none enabled and no default button, Enter is left to the ancestors of a non-editable combo box, the editor of an editable one always taking it.

      The actions replace the look and feel's enterPressed action in the action map of the combo box, delegating to it as described. Note that they are not performed while Enter transfers the focus, see ComponentBuilder.transferFocusOnEnter(boolean).

      Parameters:
      comboBox - the combo box
      action - the action
      See Also: