Search in sources :

Example 6 with StackPane

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

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

the class ScrollPaneDemo method start.

@Override
public void start(Stage stage) throws Exception {
    JFXListView<Label> list = new JFXListView<Label>();
    for (int i = 0; i < 100; i++) list.getItems().add(new Label("Item " + i));
    list.getStyleClass().add("mylistview");
    list.setMaxHeight(3400);
    StackPane container = new StackPane(list);
    container.setPadding(new Insets(24));
    JFXScrollPane pane = new JFXScrollPane();
    pane.setContent(container);
    JFXButton button = new JFXButton("");
    SVGGlyph arrow = new SVGGlyph(0, "FULLSCREEN", "M402.746 877.254l-320-320c-24.994-24.992-24.994-65.516 0-90.51l320-320c24.994-24.992 65.516-24.992 90.51 0 24.994 24.994 24.994 65.516 0 90.51l-210.746 210.746h613.49c35.346 0 64 28.654 64 64s-28.654 64-64 64h-613.49l210.746 210.746c12.496 12.496 18.744 28.876 18.744 45.254s-6.248 32.758-18.744 45.254c-24.994 24.994-65.516 24.994-90.51 0z", Color.WHITE);
    arrow.setSize(20, 16);
    button.setGraphic(arrow);
    button.setRipplerFill(Color.WHITE);
    pane.getTopBar().getChildren().add(button);
    Label title = new Label("Title");
    pane.getBottomBar().getChildren().add(title);
    title.setStyle("-fx-text-fill:WHITE; -fx-font-size: 40;");
    JFXScrollPane.smoothScrolling((ScrollPane) pane.getChildren().get(0));
    StackPane.setMargin(title, new Insets(0, 0, 0, 80));
    StackPane.setAlignment(title, Pos.CENTER_LEFT);
    StackPane.setAlignment(button, Pos.CENTER_LEFT);
    StackPane.setMargin(button, new Insets(0, 0, 0, 20));
    final Scene scene = new Scene(new StackPane(pane), 600, 600, Color.WHITE);
    stage.setTitle("JFX ListView Demo ");
    stage.setScene(scene);
    stage.show();
}
Also used : JFXScrollPane(com.jfoenix.controls.JFXScrollPane) Insets(javafx.geometry.Insets) SVGGlyph(com.jfoenix.svg.SVGGlyph) JFXListView(com.jfoenix.controls.JFXListView) Label(javafx.scene.control.Label) JFXButton(com.jfoenix.controls.JFXButton) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 8 with StackPane

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

the class TextAreaDemo method start.

@Override
public void start(Stage stage) {
    VBox main = new VBox();
    main.setSpacing(50);
    TextArea javafxTextArea = new TextArea();
    javafxTextArea.setPromptText("JavaFX Text Area");
    main.getChildren().add(javafxTextArea);
    JFXTextArea jfxTextArea = new JFXTextArea();
    jfxTextArea.setPromptText("JFoenix Text Area :D");
    jfxTextArea.setLabelFloat(true);
    RequiredFieldValidator validator = new RequiredFieldValidator();
    // NOTE adding error class to text area is causing the cursor to disapper
    validator.setErrorStyleClass("");
    validator.setMessage("Please type something!");
    validator.setIcon(new Icon(AwesomeIcon.WARNING, "1em", ";", "error"));
    jfxTextArea.getValidators().add(validator);
    jfxTextArea.focusedProperty().addListener((o, oldVal, newVal) -> {
        if (!newVal)
            jfxTextArea.validate();
    });
    main.getChildren().add(jfxTextArea);
    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, 800, 600);
    scene.getStylesheets().add(ButtonDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Button Demo");
    stage.setScene(scene);
    stage.show();
}
Also used : JFXTextArea(com.jfoenix.controls.JFXTextArea) Insets(javafx.geometry.Insets) JFXTextArea(com.jfoenix.controls.JFXTextArea) TextArea(javafx.scene.control.TextArea) Icon(de.jensd.fx.fontawesome.Icon) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) RequiredFieldValidator(com.jfoenix.validation.RequiredFieldValidator) StackPane(javafx.scene.layout.StackPane)

Example 9 with StackPane

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

the class ToolBarDemo method start.

@Override
public void start(Stage primaryStage) throws Exception {
    try {
        JFXToolbar jfxToolbar = new JFXToolbar();
        jfxToolbar.setLeftItems(new Label("Left"));
        jfxToolbar.setRightItems(new Label("Right"));
        StackPane main = new StackPane();
        main.getChildren().add(jfxToolbar);
        Scene scene = new Scene(main, 600, 400);
        scene.getStylesheets().add(ToolBarDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JFXToolbar(com.jfoenix.controls.JFXToolbar) Label(javafx.scene.control.Label) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 10 with StackPane

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

the class JFXBadge method refreshBadge.

public void refreshBadge() {
    badge.getChildren().clear();
    if (enabled) {
        //			final double scaledWidth = control.getLayoutBounds().getWidth() / getBadgeScale().doubleValue();
        //			final double scaledHeight = control.getLayoutBounds().getHeight() / getBadgeScale().doubleValue();
        //			Shape background = new Rectangle(scaledWidth, scaledHeight);
        //			Shape clip = new Rectangle(scaledWidth, scaledHeight);
        //
        //			if (maskType.get().equals(JFXBadge.BadgeMask.CIRCLE)) {
        //				double radius = Math.min(scaledWidth / 2, scaledHeight / 2);
        //				background = new Circle(radius);
        //				clip = new Circle(radius);
        //			}
        //			
        //
        //			if (badgeFill.get() instanceof Color) {
        //				Color circleColor = new Color(((Color) badgeFill.get()).getRed(), ((Color) badgeFill.get()).getGreen(),
        //						((Color) badgeFill.get()).getBlue(), ((Color) badgeFill.get()).getOpacity());
        //				background.setStroke(circleColor);
        //				background.setFill(circleColor);
        //			} else {
        //				background.setStroke(badgeFill.get());
        //				background.setFill(badgeFill.get());
        //			}
        Label labelControl = new Label(text.getValue());
        StackPane badgePane = new StackPane();
        //			badgePane.getChildren().add(background);
        badgePane.getStyleClass().add("badge-pane");
        badgePane.getChildren().add(labelControl);
        //Adding a clip would avoid overlap but this does not work as intended
        //badgePane.setClip(clip); 
        badge.getChildren().add(badgePane);
        StackPane.setAlignment(badge, getPosition());
        FadeTransition ft = new FadeTransition(Duration.millis(666), badge);
        ft.setFromValue(0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.setAutoReverse(true);
        ft.play();
    }
}
Also used : FadeTransition(javafx.animation.FadeTransition) Label(javafx.scene.control.Label) 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