Module is.codion.swing.common.ui
Interface ComponentBuilder<C extends JComponent,B extends ComponentBuilder<C,B>>
- Type Parameters:
C
- the component typeB
- the builder type
- All Superinterfaces:
Supplier<C>
- All Known Subinterfaces:
BorderLayoutPanelBuilder
,ButtonBuilder<T,
,C, B> ButtonPanelBuilder
,CheckBoxBuilder
,CheckBoxMenuItemBuilder<B>
,ComboBoxBuilder<T,
,C, B> ComponentValueBuilder<T,
,C, B> ControlPanelBuilder<C,
,B> EntityComboBox.Builder
,EntityComboBoxPanel.Builder
,EntitySearchField.Builder<T,
,B> EntitySearchField.MultiSelectionBuilder
,EntitySearchField.SingleSelectionBuilder
,EntitySearchFieldPanel.Builder<T,
,B> EntitySearchFieldPanel.MultiSelectionBuilder
,EntitySearchFieldPanel.SingleSelectionBuilder
,FileInputPanel.Builder<T>
,FilterTable.Builder<R,
,C> InputPanelBuilder
,ItemComboBoxBuilder<T>
,ItemSpinnerBuilder<T>
,LabelBuilder<T>
,ListBoxBuilder<T>
,ListBuilder<T,
,V, B> ListBuilder.Items<T>
,ListBuilder.SelectedItem<T>
,ListBuilder.SelectedItems<T>
,ListSpinnerBuilder<T>
,MaskedTextFieldBuilder
,MenuBuilder
,MenuItemBuilder<C,
,B> NumberField.Builder<T>
,NumberSpinnerBuilder<T>
,PanelBuilder
,PasswordFieldBuilder
,ProgressBarBuilder
,RadioButtonBuilder
,RadioButtonMenuItemBuilder<B>
,ScrollPaneBuilder
,SliderBuilder
,SpinnerBuilder<T,
,B> SplitPaneBuilder
,TabbedPaneBuilder
,TemporalField.Builder<T>
,TemporalFieldPanel.Builder<T>
,TextAreaBuilder
,TextComponentBuilder<T,
,C, B> TextFieldBuilder<T,
,C, B> TextFieldPanel.Builder
,TextPaneBuilder
,ToggleButtonBuilder<C,
,B> ToggleMenuItemBuilder<C,
,B> ToolBarBuilder
- All Known Implementing Classes:
AbstractComponentBuilder
,AbstractComponentValueBuilder
,DefaultComboBoxBuilder
public interface ComponentBuilder<C extends JComponent,B extends ComponentBuilder<C,B>>
extends Supplier<C>
Builds a component.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbackground
(@Nullable Color background) build()
Builds a new component instance.Builds a new component instance.clientProperty
(Object key, @Nullable Object value) Adds an arbitrary key/value "client property" to the componentcomponentListener
(ComponentListener componentListener) componentOrientation
(@Nullable ComponentOrientation orientation) enabled
(boolean enabled) Sets the enabled state of the component, for a dynamic enabled state useenabled(ObservableState)
.enabled
(@Nullable ObservableState enabled) focusable
(boolean focusable) Sets the focusable state of the component, for a dynamic focusable state usefocusable(ObservableState)
.focusable
(@Nullable ObservableState focusable) focusCycleRoot
(boolean focusCycleRoot) focusListener
(FocusListener focusListener) foreground
(@Nullable Color foreground) default C
get()
keyEvent
(KeyEvents.Builder keyEventBuilder) Enables the key event defined by the givenKeyEvents.Builder
on the component.keyListener
(KeyListener keyListener) label
(Consumer<LabelBuilder<String>> label) Is overridden bylabel(JLabel)
.Clears any label builder previously configured vialabel(Consumer)
.maximumHeight
(int maximumHeight) maximumSize
(@Nullable Dimension maximumSize) maximumWidth
(int maximumWidth) minimumHeight
(int minimumHeight) minimumSize
(@Nullable Dimension minimumSize) minimumWidth
(int minimumWidth) mouseListener
(MouseListener mouseListener) mouseMotionListener
(MouseMotionListener mouseMotionListener) mouseWheelListener
(MouseWheelListener mouseWheelListener) onSetVisible
(Consumer<C> onSetVisible) opaque
(boolean opaque) popupMenu
(@Nullable Function<C, JPopupMenu> popupMenu) popupMenuControl
(@Nullable Function<C, Control> popupMenuControl) popupMenuControls
(@Nullable Function<C, Controls> popupMenuControls) preferredHeight
(int preferredHeight) preferredSize
(@Nullable Dimension preferredSize) preferredWidth
(int preferredWidth) propertyChangeListener
(PropertyChangeListener propertyChangeListener) propertyChangeListener
(String propertyName, PropertyChangeListener propertyChangeListener) toolTipText
(@Nullable Observable<String> toolTipText) OverridestoolTipText(String)
toolTipText
(@Nullable String toolTipText) transferFocusOnEnter
(boolean transferFocusOnEnter) Note that in case ofJTextArea
theInputEvent.CTRL_DOWN_MASK
modifier is added for transferring the focus forward.transferFocusOnEnter
(TransferFocusOnEnter transferFocusOnEnter) Note that in case ofJTextArea
theInputEvent.CTRL_DOWN_MASK
modifier is added for transferring the focus forward.transferHandler
(@Nullable TransferHandler transferHandler) visible
(boolean visible) Sets the visible state of the component, for a dynamic visible state usevisible(ObservableState)
.visible
(@Nullable ObservableState visible)
-
Method Details
-
name
- Parameters:
name
- the name to assign to the component- Returns:
- this builder instance
- See Also:
-
label
Clears any label builder previously configured vialabel(Consumer)
.- Parameters:
label
- the label for the component- Returns:
- this builder instance
- See Also:
-
label
Is overridden bylabel(JLabel)
.- Parameters:
label
- configures the component label builder- Returns:
- this builder instance
- See Also:
-
focusable
Sets the focusable state of the component, for a dynamic focusable state usefocusable(ObservableState)
. Overridden byfocusable(ObservableState)
.- Parameters:
focusable
- the initial component focusability, default true- Returns:
- this builder instance
- See Also:
-
focusable
- Parameters:
focusable
- the state controlling the component focusable state- Returns:
- this builder instance
- See Also:
-
preferredHeight
- Parameters:
preferredHeight
- the preferred component height- Returns:
- this builder instance
-
preferredWidth
- Parameters:
preferredWidth
- the preferred component width- Returns:
- this builder instance
-
preferredSize
- Parameters:
preferredSize
- the preferred component size- Returns:
- this builder instance
- See Also:
-
maximumHeight
- Parameters:
maximumHeight
- the maximum component height- Returns:
- this builder instance
-
maximumWidth
- Parameters:
maximumWidth
- the maximum component width- Returns:
- this builder instance
-
maximumSize
- Parameters:
maximumSize
- the maximum component size- Returns:
- this builder instance
- See Also:
-
minimumHeight
- Parameters:
minimumHeight
- the minimum component height- Returns:
- this builder instance
-
minimumWidth
- Parameters:
minimumWidth
- the minimum component width- Returns:
- this builder instance
-
minimumSize
- Parameters:
minimumSize
- the minimum component size- Returns:
- this builder instance
- See Also:
-
border
- Parameters:
border
- the component border- Returns:
- this builder instance
- See Also:
-
transferFocusOnEnter
Note that in case of
JTextArea
theInputEvent.CTRL_DOWN_MASK
modifier is added for transferring the focus forward.- Parameters:
transferFocusOnEnter
- if true then the compnent transfers focus on enter (shift-enter for backwards)- Returns:
- this builder instance
-
transferFocusOnEnter
Note that in case of
JTextArea
theInputEvent.CTRL_DOWN_MASK
modifier is added for transferring the focus forward.- Parameters:
transferFocusOnEnter
- the transfer focus on enter to enable- Returns:
- this builder instance
-
toolTipText
- Parameters:
toolTipText
- a static tool tip text- Returns:
- this builder instance
- See Also:
-
toolTipText
OverridestoolTipText(String)
- Parameters:
toolTipText
- a dynamic tool tip text- Returns:
- this builder instance
- See Also:
-
enabled
Sets the enabled state of the component, for a dynamic enabled state useenabled(ObservableState)
. Overridden byenabled(ObservableState)
.- Parameters:
enabled
- the enabled state- Returns:
- this builder instance
- See Also:
-
enabled
- Parameters:
enabled
- the state controlling the component enabled status- Returns:
- this builder instance
-
popupMenuControl
- Parameters:
popupMenuControl
- a function, receiving the component being built, providing the control to base a popup menu on- Returns:
- this builder instance
-
popupMenuControls
- Parameters:
popupMenuControls
- a function, receiving the component being built, providing the controls to base a popup menu on- Returns:
- this builder instance
-
popupMenu
- Parameters:
popupMenu
- a function, receiving the component being built, providing the popup menu- Returns:
- this builder instance
- See Also:
-
font
- Parameters:
font
- the component font- Returns:
- this builder instance
- See Also:
-
foreground
- Parameters:
foreground
- the foreground color- Returns:
- this builder instance
- See Also:
-
background
- Parameters:
background
- the background color- Returns:
- this builder instance
- See Also:
-
opaque
- Parameters:
opaque
- true if the component should be opaque- Returns:
- this builder instance
- See Also:
-
visible
Sets the visible state of the component, for a dynamic visible state usevisible(ObservableState)
. Overridden byvisible(ObservableState)
.- Parameters:
visible
- the initial component visibility, default true- Returns:
- this builder instance
- See Also:
-
visible
- Parameters:
visible
- the state controlling the component visible state- Returns:
- this builder instance
- See Also:
-
componentOrientation
- Parameters:
orientation
- the component orientation- Returns:
- this builder instance
- See Also:
-
keyEvent
Enables the key event defined by the givenKeyEvents.Builder
on the component. Note that settingtransferFocusOnEnter(boolean)
to true overrides any conflicting key event based onKeyEvent.VK_ENTER
added via this method.- Parameters:
keyEventBuilder
- a key event builder to enable on the component- Returns:
- this builder instance
-
clientProperty
Adds an arbitrary key/value "client property" to the component- Parameters:
key
- the keyvalue
- the value- Returns:
- this builder instance
- See Also:
-
focusListener
- Parameters:
focusListener
- the focus listener- Returns:
- this builder instance
- See Also:
-
mouseListener
- Parameters:
mouseListener
- the mouse listener- Returns:
- this builder instance
- See Also:
-
mouseMotionListener
- Parameters:
mouseMotionListener
- the mouse motion listener- Returns:
- this builder instance
- See Also:
-
mouseWheelListener
- Parameters:
mouseWheelListener
- the mouse wheel listener- Returns:
- this builder instance
- See Also:
-
keyListener
- Parameters:
keyListener
- the key listener- Returns:
- this builder instance
- See Also:
-
componentListener
- Parameters:
componentListener
- the component listener- Returns:
- this builder instance
- See Also:
-
propertyChangeListener
- Parameters:
propertyChangeListener
- the property change listener- Returns:
- this builder instance
- See Also:
-
propertyChangeListener
- Parameters:
propertyName
- the name of the property to listen forpropertyChangeListener
- the property change listener- Returns:
- this builder instance
- See Also:
-
transferHandler
- Parameters:
transferHandler
- the transfer handler- Returns:
- this builder instance
- See Also:
-
focusCycleRoot
- Parameters:
focusCycleRoot
- true if the component should be the root of a focus traversal cycle- Returns:
- this builder instance
- See Also:
-
onSetVisible
- Parameters:
onSetVisible
- called when the component is made visible for the first time- Returns:
- this builder instance
-
scrollPane
ScrollPaneBuilder scrollPane()- Returns:
- a
ScrollPaneBuilder
using this component as the view
-
onBuild
- Parameters:
onBuild
- called when the component has been built.- Returns:
- this builder instance
-
build
C build()Builds a new component instance.- Returns:
- the component
-
build
Builds a new component instance.- Parameters:
onBuild
- called after the component is built.- Returns:
- the component
-
get
- Specified by:
get
in interfaceSupplier<C extends JComponent>
-