Module is.codion.swing.common.ui
Class DefaultComboBoxBuilder<T,C extends JComboBox<T>,B extends ComboBoxBuilder<T,C,B>>
java.lang.Object
is.codion.swing.common.ui.component.builder.AbstractComponentBuilder<T,C,B>
is.codion.swing.common.ui.component.combobox.DefaultComboBoxBuilder<T,C,B>
- All Implemented Interfaces:
ComponentBuilder<T,
,C, B> ComboBoxBuilder<T,
C, B>
public class DefaultComboBoxBuilder<T,C extends JComboBox<T>,B extends ComboBoxBuilder<T,C,B>>
extends AbstractComponentBuilder<T,C,B>
implements ComboBoxBuilder<T,C,B>
-
Field Summary
FieldsFields inherited from interface is.codion.swing.common.ui.component.builder.ComponentBuilder
TRANSFER_FOCUS_ON_ENTER
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DefaultComboBoxBuilder
(ComboBoxModel<T> comboBoxModel, Value<T> linkedValue) -
Method Summary
Modifier and TypeMethodDescriptionfinal B
completionMode
(Completion.Mode completionMode) protected C
protected final C
Creates the component.protected final ComponentValue<T,
C> createComponentValue
(C component) Creates the component valuefinal B
editable
(boolean editable) final B
editor
(ComboBoxEditor editor) final B
itemListener
(ItemListener itemListener) final B
maximumRowCount
(int maximumRowCount) final B
mouseWheelScrolling
(boolean mouseWheelScrolling) Enable mouse wheel scrolling on the combo boxfinal B
mouseWheelScrollingWithWrapAround
(boolean mouseWheelScrollingWithWrapAround) Enable mouse wheel scrolling on the combo box, with wrap aroundfinal 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.final B
popupWidth
(int popupWidth) Only used for the system and cross-platform Look and Feels.final B
renderer
(ListCellRenderer<T> renderer) protected final void
setInitialValue
(C component, T initialValue) Sets the initial value in the component, only called for non-null values.Methods inherited from class is.codion.swing.common.ui.component.builder.AbstractComponentBuilder
background, border, build, build, buildValue, clear, clientProperty, componentListener, componentOrientation, enabled, enabled, enableTransferFocusOnEnter, focusable, focusListener, font, foreground, initialValue, keyEvent, keyListener, label, linkedValue, linkedValue, maximumHeight, maximumSize, maximumWidth, minimumHeight, minimumSize, minimumWidth, mouseListener, mouseMotionListener, mouseWheelListener, onBuild, onSetVisible, opaque, popupMenu, popupMenuControl, popupMenuControls, preferredHeight, preferredSize, preferredWidth, propertyChangeListener, propertyChangeListener, scrollPane, supportsNull, toolTipText, transferFocusOnEnter, transferHandler, validator, visible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface is.codion.swing.common.ui.component.builder.ComponentBuilder
background, border, build, build, buildValue, clear, clientProperty, componentListener, componentOrientation, enabled, enabled, focusable, focusListener, font, foreground, initialValue, keyEvent, keyListener, label, linkedValue, linkedValue, maximumHeight, maximumSize, maximumWidth, minimumHeight, minimumSize, minimumWidth, mouseListener, mouseMotionListener, mouseWheelListener, onBuild, onSetVisible, opaque, popupMenu, popupMenuControl, popupMenuControls, preferredHeight, preferredSize, preferredWidth, propertyChangeListener, propertyChangeListener, scrollPane, toolTipText, transferFocusOnEnter, transferHandler, validator, visible
-
Field Details
-
comboBoxModel
-
-
Constructor Details
-
DefaultComboBoxBuilder
-
-
Method Details
-
editable
-
completionMode
- Specified by:
completionMode
in interfaceComboBoxBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Parameters:
completionMode
- the completion mode- Returns:
- this builder instance
-
renderer
-
editor
-
mouseWheelScrolling
Description copied from interface:ComboBoxBuilder
Enable mouse wheel scrolling on the combo box- Specified by:
mouseWheelScrolling
in interfaceComboBoxBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Parameters:
mouseWheelScrolling
- true if mouse wheel scrolling should be enabled- Returns:
- this builder instance
-
mouseWheelScrollingWithWrapAround
Description copied from interface:ComboBoxBuilder
Enable mouse wheel scrolling on the combo box, with wrap around- Specified by:
mouseWheelScrollingWithWrapAround
in interfaceComboBoxBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Parameters:
mouseWheelScrollingWithWrapAround
- true if mouse wheel scrolling with wrap around should be enabled- Returns:
- this builder instance
-
maximumRowCount
- Specified by:
maximumRowCount
in interfaceComboBoxBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Parameters:
maximumRowCount
- the maximum row count before a scroll bar is shown- Returns:
- this builder instance
- See Also:
-
moveCaretToFrontOnSelection
Description copied from interface:ComboBoxBuilder
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 forFilteredComboBoxModel
. This is enabled by default.- Specified by:
moveCaretToFrontOnSelection
in interfaceComboBoxBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - 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
Description copied from interface:ComboBoxBuilder
Only used for the system and cross-platform Look and Feels.- Specified by:
popupWidth
in interfaceComboBoxBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Parameters:
popupWidth
- a fixed popup width- Returns:
- this builder instance
-
itemListener
- Specified by:
itemListener
in interfaceComboBoxBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Parameters:
itemListener
- the item listener- Returns:
- this builder instance
- See Also:
-
createComponent
Description copied from class:AbstractComponentBuilder
Creates the component.- Specified by:
createComponent
in classAbstractComponentBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Returns:
- a new component instance
-
createComponentValue
Description copied from class:AbstractComponentBuilder
Creates the component value- Specified by:
createComponentValue
in classAbstractComponentBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Parameters:
component
- the component- Returns:
- a component value based on the component
-
setInitialValue
Description copied from class:AbstractComponentBuilder
Sets the initial value in the component, only called for non-null values.- Specified by:
setInitialValue
in classAbstractComponentBuilder<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>> - Parameters:
component
- the componentinitialValue
- the initial value, not null
-
createComboBox
-