java.lang.Object
com.amirali.fxdialogs.AlertDialog.Builder
- Enclosing class:
- AlertDialog
AlertDialog builder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadds styles to style list and that list will be added to the scenecreate()
creates AlertDialogsetDialogMessage
(@NotNull String message) sets message of the AlertDialogsetDialogTitle
(@NotNull String title) sets title of the AlertDialogsetMultiChoiceItems
(@NotNull String[] items, @NotNull Integer[] selectedIndexes, DialogInterface.OnMultiChoiceSelectedListener listener) creates and adds CheckBoxes according to the items passedsetMultiChoiceItems
(@NotNull String[] items, DialogInterface.OnMultiChoiceSelectedListener listener) creates and adds CheckBoxes according to the items passed without default selected itemssetNaturalButton
(@NotNull String text, DialogInterface.OnClickListener listener) creates the natural button on the left side of the button barsetNegativeButton
(@NotNull String text, DialogInterface.OnClickListener listener) creates the negative buttonsetNode
(@NotNull javafx.scene.Node node) sets the custom node to the center of the dialogsetPositiveButton
(@NotNull String text, DialogInterface.OnClickListener listener) creates the positive buttonsetSingleChoiceItems
(@NotNull String[] items, int selectedIndex, DialogInterface.OnSingleChoiceSelectedListener listener) creates and adds RadioButton according to the items passedsetSingleChoiceItems
(@NotNull String[] items, DialogInterface.OnSingleChoiceSelectedListener listener) creates and adds RadioButton according to the items passed without default selected itemsets the notification sound from Sounds and plays when stage is shown
Note: You need to add javafx.media dependency to use soundssets the notification sound from custom file path and plays when stage is shown
Note: You need to add javafx.media dependency to use sounds
-
Constructor Details
-
Builder
public Builder()create initial layout
-
-
Method Details
-
setDialogTitle
sets title of the AlertDialog- Parameters:
title
- title of the AlertDialog- Returns:
- Builder
-
setDialogMessage
sets message of the AlertDialog- Parameters:
message
- message of the AlertDialog- Returns:
- Builder
-
setPositiveButton
public AlertDialog.Builder setPositiveButton(@NotNull @NotNull String text, @NotNull DialogInterface.OnClickListener listener) creates the positive button- Parameters:
text
- text of the buttonlistener
- button onClickListener, when the button is clicked, the dialog closes- Returns:
- Builder
-
setNegativeButton
public AlertDialog.Builder setNegativeButton(@NotNull @NotNull String text, @NotNull DialogInterface.OnClickListener listener) creates the negative button- Parameters:
text
- text of the buttonlistener
- button onClickListener, when the button is clicked, the dialog closes- Returns:
- Builder
-
setNaturalButton
public AlertDialog.Builder setNaturalButton(@NotNull @NotNull String text, @NotNull DialogInterface.OnClickListener listener) creates the natural button on the left side of the button bar- Parameters:
text
- text of the buttonlistener
- button onClickListener, when the button is clicked, the dialog closes- Returns:
- Builder
-
addStyles
adds styles to style list and that list will be added to the scene- Parameters:
styles
- dialog styles- Returns:
- Builder
-
setSingleChoiceItems
public AlertDialog.Builder setSingleChoiceItems(@NotNull @NotNull String[] items, int selectedIndex, @NotNull DialogInterface.OnSingleChoiceSelectedListener listener) creates and adds RadioButton according to the items passed- Parameters:
items
- RadioButtons textsselectedIndex
- default selected RadioButtonlistener
- selected listener- Returns:
- Builder
-
setSingleChoiceItems
public AlertDialog.Builder setSingleChoiceItems(@NotNull @NotNull String[] items, @NotNull DialogInterface.OnSingleChoiceSelectedListener listener) creates and adds RadioButton according to the items passed without default selected item- Parameters:
items
- RadioButtons textslistener
- selected listener- Returns:
- Builder
-
setMultiChoiceItems
public AlertDialog.Builder setMultiChoiceItems(@NotNull @NotNull String[] items, @NotNull @NotNull Integer[] selectedIndexes, @NotNull DialogInterface.OnMultiChoiceSelectedListener listener) creates and adds CheckBoxes according to the items passed- Parameters:
items
- CheckBoxes textsselectedIndexes
- default selected itemslistener
- selected listener- Returns:
- Builder
-
setMultiChoiceItems
public AlertDialog.Builder setMultiChoiceItems(@NotNull @NotNull String[] items, @NotNull DialogInterface.OnMultiChoiceSelectedListener listener) creates and adds CheckBoxes according to the items passed without default selected items- Parameters:
items
- CheckBoxes textslistener
- selected listener- Returns:
- Builder
-
setNode
sets the custom node to the center of the dialog- Parameters:
node
- custom node- Returns:
- Builder
-
setSound
sets the notification sound from Sounds and plays when stage is shown
Note: You need to add javafx.media dependency to use sounds- Parameters:
sound
- default notification sounds- Returns:
- Builder
-
setSound
sets the notification sound from custom file path and plays when stage is shown
Note: You need to add javafx.media dependency to use sounds- Parameters:
path
- custom file path- Returns:
- Builder
-
create
creates AlertDialog- Returns:
- AlertDialog
-