Search in sources :

Example 11 with JFXButton

use of com.jfoenix.controls.JFXButton in project JFoenix by jfoenixadmin.

the class NodesListDemo method start.

@Override
public void start(Stage primaryStage) throws Exception {
    try {
        JFXButton ssbutton1 = new JFXButton();
        Label sslabel = new Label("R1");
        sslabel.setStyle("-fx-text-fill:WHITE");
        ssbutton1.setGraphic(sslabel);
        ssbutton1.setButtonType(ButtonType.RAISED);
        ssbutton1.getStyleClass().addAll("animated-option-button", "animated-option-sub-button2");
        JFXButton ssbutton2 = new JFXButton("R2");
        ssbutton2.setTooltip(new Tooltip("Button 2"));
        ssbutton2.setButtonType(ButtonType.RAISED);
        ssbutton2.getStyleClass().addAll("animated-option-button", "animated-option-sub-button2");
        JFXButton ssbutton3 = new JFXButton("R3");
        ssbutton3.setButtonType(ButtonType.RAISED);
        ssbutton3.getStyleClass().addAll("animated-option-button", "animated-option-sub-button2");
        JFXNodesList nodesList3 = new JFXNodesList();
        nodesList3.setSpacing(10);
        // init nodes
        nodesList3.addAnimatedNode(ssbutton1, (expanded) -> {
            return new ArrayList<KeyValue>() {

                {
                    add(new KeyValue(sslabel.rotateProperty(), expanded ? 360 : 0, Interpolator.EASE_BOTH));
                }
            };
        });
        nodesList3.addAnimatedNode(ssbutton2);
        nodesList3.addAnimatedNode(ssbutton3);
        JFXButton sbutton1 = new JFXButton();
        Label slabel = new Label("B1");
        slabel.setStyle("-fx-text-fill:WHITE");
        sbutton1.setGraphic(slabel);
        sbutton1.setButtonType(ButtonType.RAISED);
        sbutton1.getStyleClass().addAll("animated-option-button", "animated-option-sub-button");
        JFXButton sbutton2 = new JFXButton("B2");
        sbutton2.setTooltip(new Tooltip("Button 2"));
        sbutton2.setButtonType(ButtonType.RAISED);
        sbutton2.getStyleClass().addAll("animated-option-button", "animated-option-sub-button");
        JFXButton sbutton3 = new JFXButton("B3");
        sbutton3.setButtonType(ButtonType.RAISED);
        sbutton3.getStyleClass().addAll("animated-option-button", "animated-option-sub-button");
        JFXNodesList nodesList2 = new JFXNodesList();
        nodesList2.setSpacing(10);
        // init nodes
        nodesList2.addAnimatedNode(sbutton1, (expanded) -> {
            return new ArrayList<KeyValue>() {

                {
                    add(new KeyValue(slabel.rotateProperty(), expanded ? 360 : 0, Interpolator.EASE_BOTH));
                }
            };
        });
        nodesList2.addAnimatedNode(nodesList3);
        nodesList2.addAnimatedNode(sbutton2);
        nodesList2.addAnimatedNode(sbutton3);
        nodesList2.setRotate(90);
        JFXButton button1 = new JFXButton();
        Label label = new Label("G1");
        button1.setGraphic(label);
        label.setStyle("-fx-text-fill:WHITE");
        button1.setButtonType(ButtonType.RAISED);
        button1.getStyleClass().add("animated-option-button");
        JFXButton button2 = new JFXButton("G2");
        button2.setTooltip(new Tooltip("Button 2"));
        button2.setButtonType(ButtonType.RAISED);
        button2.getStyleClass().add("animated-option-button");
        JFXButton button3 = new JFXButton("G3");
        button3.setButtonType(ButtonType.RAISED);
        button3.getStyleClass().add("animated-option-button");
        JFXNodesList nodesList = new JFXNodesList();
        nodesList.setSpacing(10);
        nodesList.addAnimatedNode(button1, (expanded) -> {
            return new ArrayList<KeyValue>() {

                {
                    add(new KeyValue(label.rotateProperty(), expanded ? 360 : 0, Interpolator.EASE_BOTH));
                }
            };
        });
        nodesList.addAnimatedNode(button2);
        nodesList.addAnimatedNode(nodesList2);
        nodesList.addAnimatedNode(button3);
        nodesList.setRotate(180);
        StackPane main = new StackPane();
        main.setPadding(new Insets(10));
        JFXButton e = new JFXButton("Click Me");
        e.setTranslateY(-50);
        e.setTranslateX(-100);
        main.getChildren().add(e);
        main.getChildren().add(nodesList);
        Scene scene = new Scene(main, 600, 600);
        scene.getStylesheets().add(NodesListDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : KeyValue(javafx.animation.KeyValue) Insets(javafx.geometry.Insets) Tooltip(javafx.scene.control.Tooltip) Label(javafx.scene.control.Label) ArrayList(java.util.ArrayList) JFXButton(com.jfoenix.controls.JFXButton) JFXNodesList(com.jfoenix.controls.JFXNodesList) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 12 with JFXButton

use of com.jfoenix.controls.JFXButton in project SmartCity-Market by TechnionYP5777.

the class DialogMessagesService method showConfirmationDialog.

public static void showConfirmationDialog(String title, String header, String content, IConfiramtionDialog d) {
    JFXDialogLayout dialogContent = new JFXDialogLayout();
    dialogContent.setHeading(new Text(header == null ? title : title + "\n" + header));
    dialogContent.setBody(new Text(content));
    JFXButton yes = new JFXButton("Yes");
    yes.getStyleClass().add("JFXButton");
    JFXButton no = new JFXButton("No");
    no.getStyleClass().add("JFXButton");
    dialogContent.setActions(yes, new Label("   "), no);
    JFXDialog dialog = new JFXDialog((StackPane) AbstractApplicationScreen.stage.getScene().getRoot(), dialogContent, JFXDialog.DialogTransition.CENTER);
    yes.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent __) {
            dialog.close();
            d.onYes();
        }
    });
    no.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent __) {
            dialog.close();
            d.onNo();
        }
    });
    dialog.show();
}
Also used : ActionEvent(javafx.event.ActionEvent) Label(javafx.scene.control.Label) JFXDialog(com.jfoenix.controls.JFXDialog) Text(javafx.scene.text.Text) JFXButton(com.jfoenix.controls.JFXButton) JFXDialogLayout(com.jfoenix.controls.JFXDialogLayout)

Aggregations

JFXButton (com.jfoenix.controls.JFXButton)12 Insets (javafx.geometry.Insets)7 Scene (javafx.scene.Scene)6 Label (javafx.scene.control.Label)6 StackPane (javafx.scene.layout.StackPane)5 JFXListView (com.jfoenix.controls.JFXListView)3 SVGGlyph (com.jfoenix.svg.SVGGlyph)3 ActionEvent (javafx.event.ActionEvent)3 JFXDialog (com.jfoenix.controls.JFXDialog)2 JFXDialogLayout (com.jfoenix.controls.JFXDialogLayout)2 ArrayList (java.util.ArrayList)2 KeyValue (javafx.animation.KeyValue)2 FlowPane (javafx.scene.layout.FlowPane)2 Ingredient (BasicCommonClasses.Ingredient)1 Manufacturer (BasicCommonClasses.Manufacturer)1 IManager (EmployeeContracts.IManager)1 ConnectionFailure (EmployeeDefs.AEmployeeException.ConnectionFailure)1 EmployeeNotConnected (EmployeeDefs.AEmployeeException.EmployeeNotConnected)1 IngredientStillInUse (EmployeeDefs.AEmployeeException.IngredientStillInUse)1 InvalidParameter (EmployeeDefs.AEmployeeException.InvalidParameter)1