Search in sources :

Example 1 with JFXRippler

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

the class RipplerDemo method start.

@Override
public void start(Stage stage) {
    //TODO drop shadow changes the width and hegith thus need to be considered
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);
    Label l = new Label("Click Me");
    l.setStyle("-fx-background-color:WHITE;");
    l.setPadding(new Insets(20));
    JFXRippler lrippler = new JFXRippler(l);
    lrippler.setEnabled(false);
    main.getChildren().add(lrippler);
    l.setOnMousePressed((e) -> {
        if (i == 5)
            step = -1;
        else if (i == 0)
            step = 1;
        JFXDepthManager.setDepth(l, i += step % JFXDepthManager.getLevels());
    });
    Label l1 = new Label("TEST");
    l1.setStyle("-fx-background-color:WHITE;");
    l1.setPadding(new Insets(20));
    JFXRippler rippler1 = new JFXRippler(l1);
    main.getChildren().add(rippler1);
    JFXDepthManager.setDepth(rippler1, 1);
    Label l2 = new Label("TEST1");
    l2.setStyle("-fx-background-color:WHITE;");
    l2.setPadding(new Insets(20));
    JFXRippler rippler2 = new JFXRippler(l2);
    main.getChildren().add(rippler2);
    JFXDepthManager.setDepth(rippler2, 2);
    Label l3 = new Label("TEST2");
    l3.setStyle("-fx-background-color:WHITE;");
    l3.setPadding(new Insets(20));
    JFXRippler rippler3 = new JFXRippler(l3);
    main.getChildren().add(rippler3);
    JFXDepthManager.setDepth(rippler3, 3);
    Label l4 = new Label("TEST3");
    l4.setStyle("-fx-background-color:WHITE;");
    l4.setPadding(new Insets(20));
    JFXRippler rippler4 = new JFXRippler(l4);
    main.getChildren().add(rippler4);
    JFXDepthManager.setDepth(rippler4, 4);
    Label l5 = new Label("TEST4");
    l5.setStyle("-fx-background-color:WHITE;");
    l5.setPadding(new Insets(20));
    JFXRippler rippler5 = new JFXRippler(l5);
    main.getChildren().add(rippler5);
    JFXDepthManager.setDepth(rippler5, 5);
    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");
    final Scene scene = new Scene(pane, 600, 400);
    stage.setTitle("JavaFX Ripple effect and shadows ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();
}
Also used : Insets(javafx.geometry.Insets) JFXRippler(com.jfoenix.controls.JFXRippler) Label(javafx.scene.control.Label) FlowPane(javafx.scene.layout.FlowPane) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 2 with JFXRippler

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

the class HamburgerSlideCloseTransition method starting.

@Override
protected void starting() {
    super.starting();
    if (node.getParent() instanceof JFXRippler) {
        JFXRippler rippler = (JFXRippler) node.getParent();
        BorderPane p = new BorderPane(node);
        p.setMaxWidth(((JFXHamburger) node).getWidth());
        p.setMinWidth(((JFXHamburger) node).getWidth());
        p.addEventHandler(MouseEvent.ANY, (event) -> {
            if (!event.isConsumed()) {
                event.consume();
                node.fireEvent(event);
            }
        });
        rippler.setControl(p);
    }
    if (this.getRate() == -1) {
        ((JFXHamburger) node).getChildren().get(1).setVisible(true);
    }
}
Also used : BorderPane(javafx.scene.layout.BorderPane) JFXRippler(com.jfoenix.controls.JFXRippler) JFXHamburger(com.jfoenix.controls.JFXHamburger)

Example 3 with JFXRippler

use of com.jfoenix.controls.JFXRippler 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)

Example 4 with JFXRippler

use of com.jfoenix.controls.JFXRippler in project S4T1TM2 by CSUS-CSC-131-Spring2018.

the class YaamDemo method constructSidebar.

private void constructSidebar() {
    // sidebar
    sidebar = new Pane();
    content.getChildren().addAll(sidebar);
    sidebar.setId("sidebar");
    sidebar.layoutXProperty().bind(DoubleConstant.valueOf(0));
    sidebar.layoutYProperty().bind(brandName.heightProperty());
    sidebar.prefWidthProperty().bind(brandName.widthProperty());
    sidebar.prefHeightProperty().bind(content.heightProperty().subtract(brandName.heightProperty()));
    // projects
    ObservableValue<? extends Number> x = DoubleConstant.valueOf(0);
    for (NavScene navScene : NavScene.scenes(DashboardScene.class, ProjectsScene.class)) {
        Pane pane = new Pane();
        // 
        pane.getStyleClass().add("test");
        // pane.getStyleClass().addAll("selected");
        FontAwesomeIconView fontAwesomeIconView = new FontAwesomeIconView(navScene.icon());
        fontAwesomeIconView.getStyleClass().add("text");
        Pane pane1 = new StackPane(fontAwesomeIconView);
        Text test1 = new Text(navScene.name());
        test1.getStyleClass().add("text");
        Pane test = new StackPane(test1);
        pane1.layoutYProperty().bind(pane.heightProperty().subtract(pane1.heightProperty()).divide(2));
        pane1.layoutXProperty().bind(DoubleConstant.valueOf(20));
        test.layoutXProperty().bind(pane1.layoutXProperty().add(pane1.widthProperty()).add(10));
        test.layoutYProperty().bind(pane.heightProperty().subtract(test.heightProperty()).divide(2));
        pane.getChildren().addAll(pane1, test);
        JFXRippler rippler = new JFXRippler(pane);
        rippler.getStyleClass().add("test");
        rippler.setMaskType(JFXRippler.RipplerMask.RECT);
        rippler.minWidthProperty().bind(sidebar.widthProperty());
        rippler.maxWidthProperty().bind(sidebar.widthProperty());
        rippler.prefWidthProperty().bind(sidebar.widthProperty());
        rippler.prefHeightProperty().bind(DoubleConstant.valueOf(40));
        rippler.layoutYProperty().bind(x);
        x = rippler.layoutYProperty().add(rippler.heightProperty());
        rippler.setOnMouseClicked(event -> {
            update(navScene.getNode());
            pathTree.setRoot(new TreeItem<>(navScene.name()));
            pathTree.getSelectionModel().select(pathTree.getRoot());
            for (Node node : sidebar.getChildren()) {
                ((Parent) node).getChildrenUnmodifiable().get(0).getStyleClass().remove("selected");
            }
            pane.getStyleClass().addAll("selected");
        });
        sidebar.getChildren().add(rippler);
    }
}
Also used : JFXRippler(com.jfoenix.controls.JFXRippler) Node(javafx.scene.Node) Text(javafx.scene.text.Text) FontAwesomeIconView(de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView) StackPane(javafx.scene.layout.StackPane) ScrollPane(javafx.scene.control.ScrollPane) Pane(javafx.scene.layout.Pane) NavScene(edu.csus.yaam.client.gui.nav.NavScene) StackPane(javafx.scene.layout.StackPane)

Aggregations

JFXRippler (com.jfoenix.controls.JFXRippler)4 StackPane (javafx.scene.layout.StackPane)3 JFXHamburger (com.jfoenix.controls.JFXHamburger)2 Insets (javafx.geometry.Insets)2 Scene (javafx.scene.Scene)2 Label (javafx.scene.control.Label)2 JFXListView (com.jfoenix.controls.JFXListView)1 JFXPopup (com.jfoenix.controls.JFXPopup)1 FontAwesomeIconView (de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView)1 NavScene (edu.csus.yaam.client.gui.nav.NavScene)1 Node (javafx.scene.Node)1 ScrollPane (javafx.scene.control.ScrollPane)1 AnchorPane (javafx.scene.layout.AnchorPane)1 BorderPane (javafx.scene.layout.BorderPane)1 FlowPane (javafx.scene.layout.FlowPane)1 Pane (javafx.scene.layout.Pane)1 Text (javafx.scene.text.Text)1