JavaFX Dialog Material Design

Jfoenix is a library to build JavaFX application using Material design principal. One of my favorite library and always use it whenever i program desktop application. You can get the library from this official website, read the documentation for further use, or just put this to your Maven pom.xml :


And this is about showing dialog in JavaFX, it has modern look with shadowing and animation when it showing and closing. This is full example on how to create a dialog with Jfoenix JfxDialog:

import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDialog;
import com.jfoenix.controls.JFXDialogLayout;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class PlayGround extends Application {
    public static void main(String[] args) {

    public void start(Stage primaryStage) throws Exception {
        StackPane root = new StackPane();
        JFXButton jfxButton=new JFXButton("SHOW!");
        jfxButton.setStyle("-fx-background-color: green; -fx-text-fill: white");
        BorderPane borderPane = new BorderPane();

        JFXDialog jfxDialog = new JFXDialog();
        JFXDialogLayout content= new JFXDialogLayout();
        VBox vBox = new VBox();
        HBox hBox = new HBox();
        Label label = new Label("Are you sure want to delete!");
        HBox hBox2 = new HBox();
        JFXButton jfxButton1 = new JFXButton("Cancel");
        jfxButton1.setStyle("-fx-background-color: #eee; -fx-text-fill: #333");
        JFXButton jfxButton2 = new JFXButton("Yes");
        jfxButton2.setStyle("-fx-background-color: red; -fx-text-fill: white");
        vBox.getChildren().addAll(hBox, hBox2);

        Scene scene = new Scene(root, 700,600);
//        primaryStage.setMaximized(true);
        primaryStage.setTitle("JavaFX dialog Material Design");;

JavaFX dialog material design

Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

Spring Kafka - how to use ReplyingKafkaTemplate send and reply synchronously

How To Connect SSH Using PEM Certificate On Windows

Upload and Download Rest API using Spring Boot Reactive WebFlux

MIME Types - Complete List