Module is.codion.swing.common.ui
Interface ControlPanelBuilder<C extends JComponent,B extends ControlPanelBuilder<C,B>>
- Type Parameters:
C- the component typeB- the builder type
- All Superinterfaces:
ComponentBuilder<C,,B> Supplier<C>
- All Known Subinterfaces:
ButtonPanelBuilder,ToolBarBuilder
public interface ControlPanelBuilder<C extends JComponent,B extends ControlPanelBuilder<C,B>>
extends ComponentBuilder<C,B>
Builds panels with buttons based on controls, along with any other components, in the order added.
JToolBar toolBar = Components.toolBar()
.controls(navigationControls)
.separator()
.add(searchField)
// the settings button aligned to the right
.glue()
.control(settingsControl)
.floatable(false)
.build();
The button configuration, such as includeButtonText(boolean) and buttons(Consumer), applies
to the buttons based on the controls, components added via add(JComponent) are added as is.
Leading, trailing and adjacent duplicate separators are removed.
-
Method Summary
Modifier and TypeMethodDescriptionAdds a button based on the given action, or a toggle button in case of aToggleControl.add(Supplier<? extends JComponent> component) Adds the component provided by the given supplier when the panel is built, as is.add(JComponent component) Adds the given component, as is.buttons(Consumer<ButtonBuilder<?, ?, ?>> buttons) Configures eachButtonBuilderused to build the buttons.buttonsFocusable(boolean buttonsFocusable) checkBoxes(Consumer<CheckBoxBuilder> checkBoxes) Configures eachCheckBoxBuilderused to build the check boxes, when toggle controls are presented as check boxes, seetoggleButtonType(ToggleButtonType).Adds a button based on the given control, or a toggle button in case of aToggleControl.Adds a button based on the given control, or a toggle button in case of aToggleControl.Adds the actions of the given controls.Adds the actions of the given controls.includeButtonText(boolean includeButtonText) orientation(int orientation) preferredButtonSize(@Nullable Dimension preferredButtonSize) radioButtons(Consumer<RadioButtonBuilder> radioButtons) Configures eachRadioButtonBuilderused to build the radio buttons, when toggle controls are presented as radio buttons, seetoggleButtonType(ToggleButtonType).Adds a separator.toggleButtons(Consumer<ToggleButtonBuilder<?, ?>> toggleButtons) Configures eachToggleButtonBuilderused to build the toggle buttons, when toggle controls are presented as toggle buttons, seetoggleButtonType(ToggleButtonType).toggleButtonType(ToggleButtonType toggleButtonType) Specifies how toggle controls are presented on this control panel.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, visible
-
Method Details
-
action
Adds a button based on the given action, or a toggle button in case of aToggleControl.- Parameters:
action- the action to add- Returns:
- this builder instance
-
control
Adds a button based on the given control, or a toggle button in case of aToggleControl.- Parameters:
control- the control to add- Returns:
- this builder instance
-
control
Adds a button based on the given control, or a toggle button in case of aToggleControl.- Parameters:
control- the control to add- Returns:
- this builder instance
-
controls
Adds the actions of the given controls.- Parameters:
controls- the controls to add- Returns:
- this builder instance
-
controls
Adds the actions of the given controls.- Parameters:
controls- the controls to add- Returns:
- this builder instance
-
separator
B separator()Adds a separator.- Returns:
- this builder instance
-
add
Adds the given component, as is.- Parameters:
component- the component to add- Returns:
- this builder instance
-
add
Adds the component provided by the given supplier when the panel is built, as is.- Parameters:
component- supplies the component to add- Returns:
- this builder instance
-
orientation
- Parameters:
orientation- the panel orientation, defaultSwingConstants.HORIZONTAL- Returns:
- this builder instance
-
includeButtonText
- Parameters:
includeButtonText- true if buttons should include text- Returns:
- this builder instance
-
preferredButtonSize
- Parameters:
preferredButtonSize- the preferred button size- Returns:
- this builder instance
-
buttonsFocusable
- Parameters:
buttonsFocusable- whether the buttons should be focusable, default istrue- Returns:
- this builder instance
-
toggleButtonType
Specifies how toggle controls are presented on this control panel. The default isToggleButtonType.BUTTON.- Parameters:
toggleButtonType- the toggle button type- Returns:
- this builder instance
-
buttons
Configures eachButtonBuilderused to build the buttons.- Parameters:
buttons- receives the builder of each button- Returns:
- this builder instance
-
toggleButtons
Configures eachToggleButtonBuilderused to build the toggle buttons, when toggle controls are presented as toggle buttons, seetoggleButtonType(ToggleButtonType).- Parameters:
toggleButtons- receives the builder of each toggle button- Returns:
- this builder instance
-
checkBoxes
Configures eachCheckBoxBuilderused to build the check boxes, when toggle controls are presented as check boxes, seetoggleButtonType(ToggleButtonType).- Parameters:
checkBoxes- receives the builder of each check box- Returns:
- this builder instance
-
radioButtons
Configures eachRadioButtonBuilderused to build the radio buttons, when toggle controls are presented as radio buttons, seetoggleButtonType(ToggleButtonType).- Parameters:
radioButtons- receives the builder of each radio button- Returns:
- this builder instance
-