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<C,T, B>, ButtonPanelBuilder, CheckBoxBuilder, CheckBoxMenuItemBuilder<B>, ComboBoxBuilder<C, T, B>, ComponentValueBuilder<C, T, B>, ControlPanelBuilder<C, B>, EntityComboBox.Builder, EntityComboBoxInput.Builder, EntitySearchField.Builder, EntitySearchInput.Builder, FileInput.Builder<T>, FilterList.Builder<V, T, B>, FilterList.Builder.Items<T>, FilterList.Builder.SelectedItem<T>, FilterList.Builder.SelectedItems<T>, FilterTable.Builder<R, C>, FilterTree.Builder<T>, FlexibleGridLayoutPanelBuilder, FlowLayoutPanelBuilder, FormBuilder<B>, GridLayoutPanelBuilder, ImagePane.Builder, InputPanelBuilder, ItemComboBoxBuilder<T>, ItemSpinnerBuilder<T>, LabelBuilder<T>, LayoutPanelBuilder, ListSpinnerBuilder<T>, MaskedTextFieldBuilder, MenuBuilder, MenuItemBuilder<B>, MultiInput.Builder<C, T>, NullableCheckBoxBuilder, NumberField.Builder<T>, NumberSpinnerBuilder<T>, PanelBuilder<L, B>, PasswordFieldBuilder, ProgressBarBuilder, RadioButtonBuilder, RadioButtonMenuItemBuilder<B>, ScrollPaneBuilder, SliderBuilder, SpinnerBuilder<T, B>, SplitPaneBuilder, TabbedPaneBuilder, TemporalField.Builder<T>, TemporalInput.Builder<T>, TextAreaBuilder, TextComponentBuilder<C, T, B>, TextFieldBuilder<C, T, B>, TextInput.Builder, TextPaneBuilder, ToggleButtonBuilder<C, B>, ToggleMenuItemBuilder<C, B>, ToolBarBuilder, TreeBuilder
- All Known Implementing Classes:
AbstractComboBoxBuilder, AbstractComponentBuilder, AbstractComponentValueBuilder, AbstractFormBuilder, EditorComponents.ComponentFactory.AttributeFormBuilder
public interface ComponentBuilder<C extends JComponent, B extends ComponentBuilder<C,B>>
extends Supplier<C>
Builds a component.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionancestorListener(AncestorListener ancestorListener) background(@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) Overridesenabled(boolean).focusable(boolean focusable) Sets the focusable state of the component, for a dynamic focusable state usefocusable(ObservableState).focusable(@Nullable ObservableState focusable) Overridesfocusable(boolean).focusCycleRoot(boolean focusCycleRoot) focusListener(FocusListener focusListener) Overridesfont(UnaryOperator).font(UnaryOperator<Font> font) Derives the component font from its default font.foreground(@Nullable Color foreground) default Cget()hierarchyListener(HierarchyListener hierarchyListener) keyEvent(KeyEvents.Builder keyEventBuilder) Enables the key event defined by the givenKeyEvents.Builderon the component.keyListener(KeyListener keyListener) Specifies the label text.label(Consumer<LabelBuilder<String>> label) Configures the label.Specifies the label itself, replacing anything specified vialabel(String)orlabel(Consumer), as they in turn replace the label specified here.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<? super C> onSetVisible) opaque(boolean opaque) popupControl(Function<? super C, Control> popupMenuControl) Overridden bypopupMenu(Function).popupControls(BiConsumer<? super C, ControlsBuilder> popupMenuControl) UseControlsBuilder.removeAll()in order to clear any previously added controls.popupControls(Function<? super C, Controls> popupMenuControls) Overridden bypopupMenu(Function).popupMenu(@Nullable Function<? super C, JPopupMenu> popupMenu) 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) Overridden bytoolTipText(Observable).transferFocusOnEnter(boolean transferFocusOnEnter) Note that in case ofJTextAreatheKeyEvents.MENU_SHORTCUT_MASKmodifier is added for transferring the focus forward.transferFocusOnEnter(TransferFocusOnEnter transferFocusOnEnter) Note that in case ofJTextAreatheKeyEvents.MENU_SHORTCUT_MASKmodifier 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) Overridesvisible(boolean).
-
Method Details
-
name
-
label
Specifies the label text. Adds to whateverlabel(Consumer)has specified, and replaces a label specified vialabel(JLabel).- Parameters:
text- the label text- Returns:
- this builder instance
-
label
Specifies the label itself, replacing anything specified vialabel(String)orlabel(Consumer), as they in turn replace the label specified here.- Parameters:
label- the label for the component- Returns:
- this builder instance
- See Also:
-
label
Configures the label. Adds to whatever
label(String)and previous calls to this method have specified, and replaces a label specified vialabel(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
Overridesfocusable(boolean).- 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
-
maximumHeight
- Parameters:
maximumHeight- the maximum component height- Returns:
- this builder instance
-
maximumWidth
- Parameters:
maximumWidth- the maximum component width- Returns:
- this builder instance
-
maximumSize
-
minimumHeight
- Parameters:
minimumHeight- the minimum component height- Returns:
- this builder instance
-
minimumWidth
- Parameters:
minimumWidth- the minimum component width- Returns:
- this builder instance
-
minimumSize
-
border
-
transferFocusOnEnter
Note that in case of
JTextAreatheKeyEvents.MENU_SHORTCUT_MASKmodifier is added for transferring the focus forward.- Parameters:
transferFocusOnEnter- if true then the component transfers focus on enter (shift-enter for backwards)- Returns:
- this builder instance
-
transferFocusOnEnter
Note that in case of
JTextAreatheKeyEvents.MENU_SHORTCUT_MASKmodifier is added for transferring the focus forward.Any conflicting key event added via
keyEvent(KeyEvents.Builder)overrides this directive.- Parameters:
transferFocusOnEnter- the transfer focus on enter to enable- Returns:
- this builder instance
- See Also:
-
toolTipText
Overridden bytoolTipText(Observable).- 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
Overridesenabled(boolean).- Parameters:
enabled- the state controlling the component enabled status- Returns:
- this builder instance
-
popupControl
Overridden bypopupMenu(Function).- Parameters:
popupMenuControl- a function, receiving the component being built, providing a control to add to the popup menu- Returns:
- this builder instance
-
popupControls
Overridden bypopupMenu(Function).- Parameters:
popupMenuControls- a function, receiving the component being built, providing controls to add to the popup menu- Returns:
- this builder instance
-
popupControls
UseControlsBuilder.removeAll()in order to clear any previously added controls. Overridden bypopupMenu(Function).- Parameters:
popupMenuControl- a function, receiving the component being built and theControlsBuilderon which to base the popup menu.- Returns:
- this builder instance
- See Also:
-
popupMenu
- Parameters:
popupMenu- a function, receiving the component being built, providing the popup menu- Returns:
- this builder instance
- See Also:
-
font
Overridesfont(UnaryOperator).- Parameters:
font- the component font- Returns:
- this builder instance
- See Also:
-
font
Derives the component font from its default font. The operator is applied to the component's default font during build.Overridden by
font(Font).- Parameters:
font- provides the font to use, given the component's default font- Returns:
- this builder instance
- See Also:
-
foreground
-
background
-
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
Overridesvisible(boolean).- 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.Builderon the component.Note that adding a key event conflicting with
transferFocusOnEnter(boolean)disables focus transfer on Enter.- Parameters:
keyEventBuilder- a key event builder to enable on the component- Returns:
- this builder instance
- See Also:
-
clientProperty
-
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:
-
ancestorListener
- Parameters:
ancestorListener- the ancestor listener- Returns:
- this builder instance
- See Also:
-
hierarchyListener
- Parameters:
hierarchyListener- the hierarchy 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
-
scrollPane
ScrollPaneBuilder scrollPane()- Returns:
- a
ScrollPaneBuilderusing this component as the view
-
onBuild
-
build
-
build
-
get
- Specified by:
getin interfaceSupplier<C extends JComponent>
-