Search in sources :

Example 16 with Pane

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

the class AnimationDemo method start.

@Override
public void start(Stage stage) {
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);
    StackPane colorPane = new StackPane();
    colorPane.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
    colorPane.getStyleClass().add("red-500");
    main.getChildren().add(colorPane);
    StackPane colorPane1 = new StackPane();
    colorPane1.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
    colorPane1.getStyleClass().add("blue-500");
    StackPane placeHolder = new StackPane(colorPane1);
    placeHolder.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
    main.getChildren().add(placeHolder);
    StackPane colorPane2 = new StackPane();
    colorPane2.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
    colorPane2.getStyleClass().add("green-500");
    main.getChildren().add(colorPane2);
    StackPane colorPane3 = new StackPane();
    colorPane3.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
    colorPane3.getStyleClass().add("yellow-500");
    main.getChildren().add(colorPane3);
    StackPane colorPane4 = new StackPane();
    colorPane4.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
    colorPane4.getStyleClass().add("purple-500");
    main.getChildren().add(colorPane4);
    StackPane wizard = new StackPane();
    wizard.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    wizard.setStyle("-fx-background-color:WHITE");
    StackPane nextPage = new StackPane();
    StackPane newPlaceHolder = new StackPane();
    newPlaceHolder.setStyle("-fx-background-radius:50; -fx-max-width:50; -fx-max-height:50;");
    nextPage.getChildren().add(newPlaceHolder);
    StackPane.setAlignment(newPlaceHolder, Pos.TOP_LEFT);
    JFXHamburger h4 = new JFXHamburger();
    h4.setMaxSize(40, 40);
    HamburgerBackArrowBasicTransition burgerTask3 = new HamburgerBackArrowBasicTransition(h4);
    burgerTask3.setRate(-1);
    h4.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
        burgerTask3.setRate(burgerTask3.getRate() * -1);
        burgerTask3.play();
    });
    nextPage.getChildren().add(h4);
    StackPane.setAlignment(h4, Pos.TOP_LEFT);
    StackPane.setMargin(h4, new Insets(10));
    JFXNodesAnimation<FlowPane, StackPane> animation = new JFXNodesAnimation<FlowPane, StackPane>(main, nextPage) {

        private Pane tempPage = new Pane();

        double x = 0;

        double y = 0;

        @Override
        public void init() {
            nextPage.setOpacity(0);
            wizard.getChildren().add(tempPage);
            wizard.getChildren().add(nextPage);
            x = colorPane1.localToScene(colorPane1.getBoundsInLocal()).getMinX();
            y = colorPane1.localToScene(colorPane1.getBoundsInLocal()).getMinY();
            tempPage.getChildren().add(colorPane1);
            colorPane1.setTranslateX(x);
            colorPane1.setTranslateY(y);
        }

        @Override
        public void end() {
        }

        @Override
        public Animation animateSharedNodes() {
            return new Timeline();
        }

        @Override
        public Animation animateExit() {
            return new Timeline(new KeyFrame(Duration.millis(300), new KeyValue(main.opacityProperty(), 0, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(520), new KeyValue(colorPane1.translateXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(colorPane1.translateYProperty(), 0, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(200), new KeyValue(colorPane1.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(colorPane1.scaleYProperty(), 1, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(1000), new KeyValue(colorPane1.scaleXProperty(), 40, Interpolator.EASE_BOTH), new KeyValue(colorPane1.scaleYProperty(), 40, Interpolator.EASE_BOTH)));
        }

        @Override
        public Animation animateEntrance() {
            return new Timeline(new KeyFrame(Duration.millis(320), new KeyValue(nextPage.opacityProperty(), 1, Interpolator.EASE_BOTH)));
        }
    };
    colorPane1.setOnMouseClicked((click) -> {
        animation.animate();
    });
    //		wizard.getChildren().add(nextPage);
    final Scene scene = new Scene(wizard, 800, 200);
    scene.getStylesheets().add(ButtonDemo.class.getResource("/resources/css/jfoenix-design.css").toExternalForm());
    scene.getStylesheets().add(ButtonDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Button Demo");
    stage.setScene(scene);
    stage.show();
}
Also used : Insets(javafx.geometry.Insets) HamburgerBackArrowBasicTransition(com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition) JFXHamburger(com.jfoenix.controls.JFXHamburger) FlowPane(javafx.scene.layout.FlowPane) JFXNodesAnimation(com.jfoenix.animation.JFXNodesAnimation) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane) FlowPane(javafx.scene.layout.FlowPane) Pane(javafx.scene.layout.Pane) StackPane(javafx.scene.layout.StackPane)

Example 17 with Pane

use of javafx.scene.layout.Pane in project PayFile by mikehearn.

the class Main method overlayUI.

/** Loads the FXML file with the given name, blurs out the main UI and puts this one on top. */
public <T> OverlayUI<T> overlayUI(String name) {
    return evalUnchecked(() -> {
        checkGuiThread();
        // Load the UI from disk.
        URL location = getClass().getResource(name);
        FXMLLoader loader = new FXMLLoader(location);
        Pane ui = loader.load();
        T controller = loader.getController();
        OverlayUI<T> pair = new OverlayUI<>(ui, controller);
        // Auto-magically set the overlayUi member, if it's there.
        controller.getClass().getDeclaredField("overlayUi").set(controller, pair);
        pair.show();
        return pair;
    });
}
Also used : FXMLLoader(javafx.fxml.FXMLLoader) StackPane(javafx.scene.layout.StackPane) Pane(javafx.scene.layout.Pane) URL(java.net.URL)

Example 18 with Pane

use of javafx.scene.layout.Pane in project Smartcity-Smarthouse by TechnionYP5777.

the class RoomViewController method initialize.

@Override
public void initialize(final URL location1, final ResourceBundle __) {
    pane = new Pane();
    pane.setOnMouseClicked(event -> {
        if (event.getTarget() == pane && inEditMode)
            addSensor(event.getX(), event.getY());
    });
    editButton.setOnAction(__1 -> {
        final String buttonText = inEditMode ? "Edit" : "Save";
        editButton.setText(buttonText);
        labels.forEach(c -> c.switchMovableState());
        inEditMode = !inEditMode;
    });
}
Also used : StackPane(javafx.scene.layout.StackPane) AnchorPane(javafx.scene.layout.AnchorPane) Pane(javafx.scene.layout.Pane)

Example 19 with Pane

use of javafx.scene.layout.Pane in project Smartcity-Smarthouse by TechnionYP5777.

the class Controller method initialize.

@Override
public void initialize(final URL location, final ResourceBundle __) {
    pulseLabel.setDisable(false);
    bpLabel.setDisable(false);
    xAxis.setForceZeroInRange(false);
    xAxis.setAutoRanging(false);
    xAxis.setTickLabelsVisible(false);
    xAxis.setTickMarkVisible(false);
    xAxis.setMinorTickVisible(false);
    final NumberAxis bpYAxis = new NumberAxis();
    bpYAxis.setLabel("Blood Pressure (mmHg)");
    final NumberAxis pulseXAxis = new NumberAxis();
    pulseXAxis.setAutoRanging(false);
    pulseXAxis.setVisible(false);
    pulseXAxis.lowerBoundProperty().bind(xAxis.lowerBoundProperty());
    pulseXAxis.upperBoundProperty().bind(xAxis.upperBoundProperty());
    pulseXAxis.tickUnitProperty().bind(xAxis.tickUnitProperty());
    final NumberAxis pulseYAxis = new NumberAxis();
    pulseYAxis.setSide(Side.RIGHT);
    pulseYAxis.setLabel("Pulse (BPM)");
    final LineChart<Number, Number> bpLineChart = new LineChart<Number, Number>(xAxis, bpYAxis) {

        @Override
        protected void dataItemAdded(final Series<Number, Number> __1, final int itemIndex, final Data<Number, Number> item) {
        // remove symbols from data points
        }
    }, pulseLineChart = new LineChart<Number, Number>(xAxis, pulseYAxis) {

        @Override
        protected void dataItemAdded(final Series<Number, Number> __1, final int itemIndex, final Data<Number, Number> item) {
        // remove symbols from data points
        }
    };
    bpLineChart.setDisable(false);
    pulseLineChart.setDisable(false);
    tmpSeries.setName("Pulse");
    systolicSeries.setName("Systolic");
    diastolicSeries.setName("Diastolic");
    pulseLineChart.getData().add(pulseSeries);
    bpLineChart.getData().add(tmpSeries);
    bpLineChart.getData().add(systolicSeries);
    bpLineChart.getData().add(diastolicSeries);
    bpLineChart.lookup(".chart-content").lookup(".chart-plot-background").setStyle("-fx-background-color: transparent;");
    bpLineChart.setVerticalGridLinesVisible(false);
    bpLineChart.setHorizontalGridLinesVisible(false);
    // stackPane.getChildren().add(pulseLineChart);
    // stackPane.getChildren().add(bpLineChart);
    final Pane tmpBackPane = new Pane();
    tmpBackPane.setMinSize(50, Region.USE_COMPUTED_SIZE);
    tmpBackPane.setMaxSize(50, Region.USE_COMPUTED_SIZE);
    final Pane tmpFrontPane = new Pane();
    tmpFrontPane.setMinSize(50, Region.USE_COMPUTED_SIZE);
    tmpFrontPane.setMaxSize(50, Region.USE_COMPUTED_SIZE);
    backHBox.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
    frontHBox.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
    HBox.setHgrow(pulseLineChart, Priority.ALWAYS);
    HBox.setHgrow(bpLineChart, Priority.ALWAYS);
    VBox.setVgrow(stackPane, Priority.ALWAYS);
    backHBox.getChildren().add(tmpBackPane);
    backHBox.getChildren().add(pulseLineChart);
    frontHBox.getChildren().add(bpLineChart);
    frontHBox.getChildren().add(tmpFrontPane);
    stackPane.getChildren().add(backHBox);
    stackPane.getChildren().add(frontHBox);
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) StackPane(javafx.scene.layout.StackPane) Pane(javafx.scene.layout.Pane) LineChart(javafx.scene.chart.LineChart)

Example 20 with Pane

use of javafx.scene.layout.Pane in project aima-java by aimacode.

the class IntegratedAppBuilder method getResultFor.

/**
	 * Creates a scene with menu bar and a scalable container pane,
	 * assigns it to the stage, and returns a controller instance containing
	 * user interface logic.
	 * @return A controller class (will seldom be used by the caller).
	 */
public IntegratedAppPaneCtrl getResultFor(Stage stage) {
    // create a pane, content is affected by scale
    final DoubleProperty scale = paneCtrl.scaleProperty();
    BorderPane appPane = new BorderPane();
    appPane.scaleXProperty().bind(scale);
    appPane.scaleYProperty().bind(scale);
    Pane appPaneContainer = new Pane();
    appPaneContainer.getChildren().add(appPane);
    appPane.prefWidthProperty().bind(appPaneContainer.widthProperty().divide(scale));
    appPane.prefHeightProperty().bind(appPaneContainer.heightProperty().divide(scale));
    appPane.translateXProperty().bind(appPaneContainer.widthProperty().subtract(appPane.prefWidthProperty()).divide(2));
    appPane.translateYProperty().bind(appPaneContainer.heightProperty().subtract(appPane.prefHeightProperty()).divide(2));
    paneCtrl.setContext(appPane, stage, title);
    BorderPane root = new BorderPane();
    root.setTop(menuBar);
    root.setCenter(appPaneContainer);
    stage.setScene(new Scene(root, sceneWidth, sceneHeight));
    // just in case, the builder is called twice...
    IntegratedAppPaneCtrl result = paneCtrl;
    paneCtrl = new IntegratedAppPaneCtrl();
    return result;
}
Also used : BorderPane(javafx.scene.layout.BorderPane) DoubleProperty(javafx.beans.property.DoubleProperty) Scene(javafx.scene.Scene) BorderPane(javafx.scene.layout.BorderPane) Pane(javafx.scene.layout.Pane)

Aggregations

Pane (javafx.scene.layout.Pane)34 StackPane (javafx.scene.layout.StackPane)13 IOException (java.io.IOException)12 FXMLLoader (javafx.fxml.FXMLLoader)12 Node (javafx.scene.Node)7 BorderPane (javafx.scene.layout.BorderPane)6 Scene (javafx.scene.Scene)5 Label (javafx.scene.control.Label)5 ArrayList (java.util.ArrayList)4 AnchorPane (javafx.scene.layout.AnchorPane)4 Stage (javafx.stage.Stage)4 HashMap (java.util.HashMap)3 List (java.util.List)3 FXML (javafx.fxml.FXML)3 ScrollPane (javafx.scene.control.ScrollPane)3 UserThread (io.bitsquare.common.UserThread)2 Insets (javafx.geometry.Insets)2 Parent (javafx.scene.Parent)2 Button (javafx.scene.control.Button)2 TabPane (javafx.scene.control.TabPane)2