i search for an example for jfoenix jfxdialog anybody has working demo of this
JFXDialog dialog = new JFXDialog();
JFXDialog has three different constructors:
JFXDialog(), JFXDialog(StackPane dialogContainer, Region content, DialogTransition transitionType) and JFXDialog(StackPane dialogContainer, Region content, DialogTransition transitionType, boolean overlayClose)The first one just sets the animationType to Center.
The second one sets the Parent(dialogContainer), the content(content) and the animationType(transitionType).
The third one sets the same as the second one + if the dialog should close if you click on the overlay(overlayClose).
For the parent of the Dialog you need a StackPane.
For the content you can use anything which is a child, grandchild, ... of Region. I would suggest you to use a JFXDialogLayout as it extends StackPane and makes it easier to style you dialog.
For the transitionType you have five different ones:
DialogTransition.TOPDialogTransition.RIGHTDialogTransition.BOTTOMDialogTransition.LEFTDialogTransition.CENTER If you want to close it by clicking on the overlay set overlayClose to true, else set it to false
Some usefull methods which JFXDialog has:
setDialogContainer(StackPane dialogContainer) sets the Parent.setContent(Region content) sets the Content of your Dialog.setOverlayClose(final boolean overlayClose) you set wheter you want to close the Dialog by clicking on the overlay or not.show(StackPane dialogContainer) shows the JFXDialog in the given StackPane
show() shows the JFXDialog in its parentclose() closes the JFXDialog
setTransitionType(DialogTransition transition) sets the DialogTransition to one of those mentioned beforesetOnDialogClosed(EventHandler<? super JFXDialogEvent> handler) Defines a function to be called when the dialog is closed. It will be triggered after the close animation is finished.setOnDialogOpened(EventHandler<? super JFXDialogEvent> handler) Defines a function to be called when the dialog is opened. It will be triggered after the show animation is finished.JFXDialogLayout has just an empty constructor but contains out of a heading, body and actions.
The JFXDialogLayout class provides a setter for all those parts. Those are:
setHeading(Node... titleContentsetBody(Node... body)setActions(Node... actions)If you don't know, because of the three dots after Node you can add unlimited Nodes to all three parts. This is a feature called Varargs
For further information take a look at the demo on github at the Java controller JFoenix/Dialog Container and at the FXML file JFoenix/JFXDialog.fxml
Also here is the source code of the controls containing JFXDialog and JFXDialogLayout JFoenix/controls
I would suggest you to write your JavaFX applications seperated in Java, FXML and CSS files. Why Use FXML
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With