Search in sources :

Example 36 with StackPane

use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.

the class MasonryPaneController method init.

@PostConstruct
public void init() throws FlowException, VetoException {
    ArrayList<Node> children = new ArrayList<>();
    for (int i = 0; i < 20; i++) {
        StackPane child = new StackPane();
        double width = Math.random() * 100 + 100;
        child.setMinWidth(width);
        child.setMaxWidth(width);
        child.setPrefWidth(width);
        double height = Math.random() * 100 + 100;
        child.setMinHeight(height);
        child.setMaxHeight(height);
        child.setPrefHeight(height);
        JFXDepthManager.setDepth(child, 1);
        children.add(child);
        // create content
        VBox content = new VBox();
        StackPane header = new StackPane();
        String headerColor = getDefaultColor(i % 12);
        header.setStyle("-fx-background-radius: 5 5 0 0; -fx-background-color: " + headerColor);
        VBox.setVgrow(header, Priority.ALWAYS);
        StackPane body = new StackPane();
        body.setMinHeight(Math.random() * 20 + 50);
        content.getChildren().addAll(header, body);
        body.setStyle("-fx-background-radius: 0 0 5 5; -fx-background-color: rgb(255,255,255,0.87);");
        // create button
        JFXButton button = new JFXButton("");
        button.setButtonType(ButtonType.RAISED);
        button.setStyle("-fx-background-radius: 40;-fx-background-color: " + getDefaultColor((int) ((Math.random() * 12) % 12)));
        button.setPrefSize(40, 40);
        button.setRipplerFill(Color.valueOf(headerColor));
        button.setScaleX(0);
        button.setScaleY(0);
        SVGGlyph glyph = new SVGGlyph(-1, "test", "M1008 6.286q18.857 13.714 15.429 36.571l-146.286 877.714q-2.857 16.571-18.286 25.714-8 4.571-17.714 4.571-6.286 0-13.714-2.857l-258.857-105.714-138.286 168.571q-10.286 13.143-28 13.143-7.429 0-12.571-2.286-10.857-4-17.429-13.429t-6.571-20.857v-199.429l493.714-605.143-610.857 528.571-225.714-92.571q-21.143-8-22.857-31.429-1.143-22.857 18.286-33.714l950.857-548.571q8.571-5.143 18.286-5.143 11.429 0 20.571 6.286z", Color.WHITE);
        glyph.setSize(20, 20);
        button.setGraphic(glyph);
        button.translateYProperty().bind(Bindings.createDoubleBinding(() -> {
            return header.getBoundsInParent().getHeight() - button.getHeight() / 2;
        }, header.boundsInParentProperty(), button.heightProperty()));
        StackPane.setMargin(button, new Insets(0, 12, 0, 0));
        StackPane.setAlignment(button, Pos.TOP_RIGHT);
        Timeline animation = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(button.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(button.scaleYProperty(), 1, Interpolator.EASE_BOTH)));
        animation.setDelay(Duration.millis(100 * i + (1000)));
        animation.play();
        child.getChildren().addAll(content, button);
    }
    masonryPane.getChildren().addAll(children);
    Platform.runLater(() -> scrollPane.requestLayout());
    JFXScrollPane.smoothScrolling(scrollPane);
}
Also used : Insets(javafx.geometry.Insets) KeyValue(javafx.animation.KeyValue) Node(javafx.scene.Node) ArrayList(java.util.ArrayList) JFXButton(com.jfoenix.controls.JFXButton) Timeline(javafx.animation.Timeline) SVGGlyph(com.jfoenix.svg.SVGGlyph) KeyFrame(javafx.animation.KeyFrame) VBox(javafx.scene.layout.VBox) StackPane(javafx.scene.layout.StackPane) PostConstruct(javax.annotation.PostConstruct)

Example 37 with StackPane

use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.

the class SpinnerDemo method start.

@Override
public void start(final Stage stage) throws Exception {
    StackPane pane = new StackPane();
    JFXSpinner root = new JFXSpinner();
    pane.getChildren().add(root);
    final Scene scene = new Scene(pane, 300, 300);
    scene.getStylesheets().add(MainDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
    stage.setScene(scene);
    stage.setTitle("JFX Spinner Demo");
    stage.show();
}
Also used : JFXSpinner(com.jfoenix.controls.JFXSpinner) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 38 with StackPane

use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.

the class HamburgerDemo method start.

@Override
public void start(Stage stage) {
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);
    JFXHamburger h1 = new JFXHamburger();
    HamburgerSlideCloseTransition burgerTask = new HamburgerSlideCloseTransition(h1);
    burgerTask.setRate(-1);
    h1.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
        burgerTask.setRate(burgerTask.getRate() * -1);
        burgerTask.play();
    });
    JFXHamburger h2 = new JFXHamburger();
    HamburgerBasicCloseTransition burgerTask1 = new HamburgerBasicCloseTransition(h2);
    burgerTask1.setRate(-1);
    h2.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
        burgerTask1.setRate(burgerTask1.getRate() * -1);
        burgerTask1.play();
    });
    JFXHamburger h3 = new JFXHamburger();
    HamburgerBackArrowBasicTransition burgerTask2 = new HamburgerBackArrowBasicTransition(h3);
    burgerTask2.setRate(-1);
    h3.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
        burgerTask2.setRate(burgerTask2.getRate() * -1);
        burgerTask2.play();
    });
    JFXHamburger h4 = new JFXHamburger();
    HamburgerNextArrowBasicTransition burgerTask3 = new HamburgerNextArrowBasicTransition(h4);
    burgerTask3.setRate(-1);
    h4.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
        burgerTask3.setRate(burgerTask3.getRate() * -1);
        burgerTask3.play();
    });
    main.getChildren().add(h1);
    main.getChildren().add(h2);
    main.getChildren().add(h3);
    main.getChildren().add(h4);
    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(60));
    pane.setStyle("-fx-background-color:WHITE");
    final Scene scene = new Scene(pane, 400, 200);
    scene.getStylesheets().add(HamburgerDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Burgers Demo :) ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();
}
Also used : HamburgerSlideCloseTransition(com.jfoenix.transitions.hamburger.HamburgerSlideCloseTransition) Insets(javafx.geometry.Insets) HamburgerBackArrowBasicTransition(com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition) JFXHamburger(com.jfoenix.controls.JFXHamburger) HamburgerNextArrowBasicTransition(com.jfoenix.transitions.hamburger.HamburgerNextArrowBasicTransition) FlowPane(javafx.scene.layout.FlowPane) HamburgerBasicCloseTransition(com.jfoenix.transitions.hamburger.HamburgerBasicCloseTransition) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 39 with StackPane

use of javafx.scene.layout.StackPane 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 40 with StackPane

use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.

the class PopupDemo method start.

@Override
public void start(Stage primaryStage) throws Exception {
    JFXHamburger show = new JFXHamburger();
    show.setPadding(new Insets(10, 5, 10, 5));
    JFXRippler r = new JFXRippler(show, RipplerMask.CIRCLE, RipplerPos.BACK);
    JFXListView<Label> list = new JFXListView<Label>();
    for (int i = 1; i < 5; i++) list.getItems().add(new Label("Item " + i));
    AnchorPane container = new AnchorPane();
    container.getChildren().add(r);
    AnchorPane.setLeftAnchor(r, 200.0);
    AnchorPane.setTopAnchor(r, 210.0);
    StackPane main = new StackPane();
    main.getChildren().add(container);
    JFXPopup popup = new JFXPopup(list);
    r.setOnMouseClicked((e) -> popup.show(r, PopupVPosition.TOP, PopupHPosition.LEFT));
    final Scene scene = new Scene(main, 800, 800);
    scene.getStylesheets().add(PopupDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
    primaryStage.setTitle("JFX Popup Demo");
    primaryStage.setScene(scene);
    primaryStage.setResizable(false);
    primaryStage.show();
}
Also used : JFXPopup(com.jfoenix.controls.JFXPopup) Insets(javafx.geometry.Insets) JFXRippler(com.jfoenix.controls.JFXRippler) JFXHamburger(com.jfoenix.controls.JFXHamburger) JFXListView(com.jfoenix.controls.JFXListView) Label(javafx.scene.control.Label) Scene(javafx.scene.Scene) AnchorPane(javafx.scene.layout.AnchorPane) StackPane(javafx.scene.layout.StackPane)

Aggregations

StackPane (javafx.scene.layout.StackPane)63 Scene (javafx.scene.Scene)34 Insets (javafx.geometry.Insets)15 BorderPane (javafx.scene.layout.BorderPane)12 Label (javafx.scene.control.Label)9 Parameter (aima.gui.fx.framework.Parameter)8 SimulationPaneBuilder (aima.gui.fx.framework.SimulationPaneBuilder)8 FlowPane (javafx.scene.layout.FlowPane)8 VBox (javafx.scene.layout.VBox)6 JFXButton (com.jfoenix.controls.JFXButton)5 Group (javafx.scene.Group)5 MapPaneCtrl (aimax.osm.gui.fx.viewer.MapPaneCtrl)4 ArrayList (java.util.ArrayList)4 Platform (javafx.application.Platform)4 Node (javafx.scene.Node)4 Button (javafx.scene.control.Button)4 Color (javafx.scene.paint.Color)4 WebView (javafx.scene.web.WebView)4 JFXHamburger (com.jfoenix.controls.JFXHamburger)3 JFXTextField (com.jfoenix.controls.JFXTextField)3