Interface ComboBoxBuilder<C extends JComboBox<T>,T,B extends ComboBoxBuilder<C,T,B>>
- Type Parameters:
C- the component typeT- the value typeB- the builder type
- All Superinterfaces:
ComponentBuilder<C,,B> ComponentValueBuilder<C,,T, B> Supplier<C>
- All Known Subinterfaces:
EntityComboBox.Builder
- All Known Implementing Classes:
DefaultComboBoxBuilder
JComboBox.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<Boolean> Specifies whether mouse wheel scrolling is enabled in combo boxes by default.Fields inherited from interface is.codion.swing.common.ui.component.builder.ComponentValueBuilder
COMPONENT_VALUE -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddEnterAction(JComboBox<?> comboBox, Action action) Adds an action for Enter to the given combo box, consulted after the ones already added.static ComboBoxBuilder.ModelStepbuilder()completionMode(Completion.Mode completionMode) editable(boolean editable) editor(@Nullable ComboBoxEditor editor) static voidenableMouseWheelSelection(JComboBox<?> comboBox) Enables mouse wheel selection for the given combo boxstatic voidenableMouseWheelSelectionWithWrapAround(JComboBox<?> comboBox) Enables mouse wheel selection for the given combo box with wrap aroundenterAction(Action action) Adds an action for Enter, consulted after the ones already added, seeaddEnterAction(JComboBox, Action).itemListener(ItemListener itemListener) maximumRowCount(int maximumRowCount) mouseWheelScrolling(boolean mouseWheelScrolling) Enable mouse wheel scrolling on the combo boxmouseWheelScrollingWithWrapAround(boolean mouseWheelScrollingWithWrapAround) Enable mouse wheel scrolling on the combo box, with wrap aroundmoveCaretToFrontOnSelection(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.normalize(boolean normalize) Specifies whether to normalize strings during auto-completionpopupWidth(int popupWidth) Only applicable for the system and cross-platform Look and Feels.renderer(@Nullable ListCellRenderer<? super T> renderer) Methods inherited from interface is.codion.swing.common.ui.component.builder.ComponentBuilder
ancestorListener, background, border, build, build, clientProperty, componentListener, componentOrientation, enabled, enabled, focusable, focusable, focusCycleRoot, focusListener, font, font, foreground, get, hierarchyListener, keyEvent, keyListener, label, label, label, maximumHeight, maximumSize, maximumWidth, minimumHeight, minimumSize, minimumWidth, mouseListener, mouseMotionListener, mouseWheelListener, name, onBuild, onSetVisible, opaque, popupControl, popupControls, popupControls, popupMenu, preferredHeight, preferredSize, preferredWidth, propertyChangeListener, propertyChangeListener, scrollPane, toolTipText, toolTipText, transferFocusOnEnter, transferFocusOnEnter, transferHandler, visible, visibleMethods inherited from interface is.codion.swing.common.ui.component.builder.ComponentValueBuilder
buildValue, buildValue, changeConsumer, changeListener, consumer, link, link, listener, modified, modifiedIndicator, onBuildValue, valid, valid, validationIndicator, validator, value, warned, weakChangeConsumer, weakChangeListener, weakConsumer, weakListener, when, when, when, when
-
Field Details
-
MOUSE_WHEEL_SCROLLING
Specifies whether mouse wheel scrolling is enabled in combo boxes by default.- Value type:Boolean
- Default value: true
-
-
Method Details
-
editable
- Parameters:
editable- specifies whether the combo box should be editable- Returns:
- this builder instance
- See Also:
-
completionMode
- Parameters:
completionMode- the completion mode- Returns:
- this builder instance
-
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
- Parameters:
renderer- the renderer for the combo box- Returns:
- this builder instance
- See Also:
-
editor
- Parameters:
editor- the editor for the combo box- Returns:
- this builder instance
- See Also:
-
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
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
- Parameters:
maximumRowCount- the maximum row count before a scroll bar is shown- Returns:
- this builder instance
- See Also:
-
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 aSwingFilterComboBoxModel. 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
Only applicable for the system and cross-platform Look and Feels.- Parameters:
popupWidth- a fixed popup width- Returns:
- this builder instance
-
itemListener
- Parameters:
itemListener- the item listener- Returns:
- this builder instance
- See Also:
-
enterAction
Adds an action for Enter, consulted after the ones already added, seeaddEnterAction(JComboBox, Action). Note that this disablesComponentBuilder.transferFocusOnEnter(boolean), which would otherwise take the Enter key.- Parameters:
action- the action- Returns:
- this builder instance
-
builder
- Returns:
- a
ComboBoxBuilder.ModelStep
-
enableMouseWheelSelection
Enables mouse wheel selection for the given combo box- Parameters:
comboBox- the combo box
-
enableMouseWheelSelectionWithWrapAround
Enables mouse wheel selection for the given combo box with wrap around- Parameters:
comboBox- the combo box
-
addEnterAction
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
enterPressedaction in the action map of the combo box, delegating to it as described. Note that they are not performed while Enter transfers the focus, seeComponentBuilder.transferFocusOnEnter(boolean).- Parameters:
comboBox- the combo boxaction- the action- See Also:
-