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();
}
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);
}
}
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();
}
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);
}
}
Aggregations