java.lang.Object
io.github.palexdev.materialfx.controls.MFXContextMenuItem.Builder
- Enclosing class:
- MFXContextMenuItem
Builder class that facilitates the creation of items with fluent api.
An example:
MFXContextMenuItem item = MFXContextMenuItem.Builder.build()
.setIcon(icon)
.setText("Menu Item 1)
.setAccelerator("Ctrl + P)
.setTooltipSupplier(() -> new Tooltip("Performs action P"))
.setAction(event -> actionP())
.get();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MFXContextMenuItem.Builderbuild()get()setAccelerator(String accelerator) Sets the item's accelerator text.setAccelerator(KeyCombination combination) Sets the item's accelerator text from the givenKeyCombination.Sets the item's icon.setOnAction(EventHandler<ActionEvent> onAction) Sets the item's action to perform on click.Sets the item's text.setTooltipSupplier(Supplier<Tooltip> tooltipSupplier) Sets the item's tooltip supplier.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
- Returns:
- a new Builder instance
-
setIcon
Sets the item's icon. -
setText
Sets the item's text. -
setAccelerator
Sets the item's accelerator text. -
setAccelerator
Sets the item's accelerator text from the givenKeyCombination. -
setTooltipSupplier
Sets the item's tooltip supplier. -
setOnAction
Sets the item's action to perform on click. -
get
- Returns:
- the built item
-