<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>8.0.9</version>
</dependency>
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) {
launch();
}
@Override
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();
borderPane.setCenter(jfxButton);
root.getChildren().addAll(borderPane);
JFXDialog jfxDialog = new JFXDialog();
JFXDialogLayout content= new JFXDialogLayout();
VBox vBox = new VBox();
vBox.setSpacing(10);
HBox hBox = new HBox();
Label label = new Label("Are you sure want to delete!");
hBox.getChildren().addAll(label);
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");
hBox2.getChildren().addAll(jfxButton1,jfxButton2);
vBox.getChildren().addAll(hBox, hBox2);
content.setBody(vBox);
jfxDialog.setContent(content);
jfxDialog.setDialogContainer(root);
Scene scene = new Scene(root, 700,600);
// primaryStage.setMaximized(true);
jfxButton.setOnAction(act->{
jfxDialog.show();
});
primaryStage.setScene(scene);
primaryStage.setTitle("JavaFX dialog Material Design");
primaryStage.show();
}
}
Join the discussion
We welcome thoughtful feedback and questions.
Sign in to comment
Use your account to join the conversation, or create one in seconds.
Log in to your account
Create your reader account
Commenting as