Search in sources :

Example 41 with StackPane

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

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

the class ColorPickerDemo method start.

@Override
public void start(Stage stage) {
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);
    javafx.scene.control.ColorPicker picker = new javafx.scene.control.ColorPicker(Color.RED);
    picker.getStyleClass().add("button");
    //		picker.getStyleClass().add("split-button");		 
    main.getChildren().add(picker);
    main.getChildren().add(new JFXColorPicker());
    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, 200);
    //		scene.getStylesheets().add(ButtonDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Button Demo");
    stage.setScene(scene);
    stage.show();
}
Also used : JFXColorPicker(com.jfoenix.controls.JFXColorPicker) Insets(javafx.geometry.Insets) JFXColorPicker(com.jfoenix.controls.JFXColorPicker) FlowPane(javafx.scene.layout.FlowPane) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 43 with StackPane

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

the class Main method init.

private void init(Stage mainWindow) throws IOException {
    this.mainWindow = mainWindow;
    // commented out for now as Modena looks better, but might want to bring this back.
    /* if (System.getProperty("os.name").toLowerCase().contains("mac")) {
            AquaFx.style();
        } */
    // Load the GUI. The Controller class will be automagically created and wired up.
    URL location = getClass().getResource("main.fxml");
    FXMLLoader loader = new FXMLLoader(location);
    mainUI = loader.load();
    controller = loader.getController();
    // Configure the window with a StackPane so we can overlay things on top of the main UI.
    uiStack = new StackPane(mainUI);
    mainWindow.setTitle(APP_NAME);
    final Scene scene = new Scene(uiStack);
    // Add CSS that we need.
    TextFieldValidator.configureScene(scene);
    mainWindow.setScene(scene);
    // Make log output concise.
    BriefLogFormatter.init();
    // Tell bitcoinj to run event handlers on the JavaFX UI thread. This keeps things simple and means
    // we cannot forget to switch threads when adding event handlers. Unfortunately, the DownloadListener
    // we give to the app kit is currently an exception and runs on a library thread. It'll get fixed in
    // a future version. Also note that this doesn't affect the default executor for ListenableFutures.
    // That must be specified each time.
    Threading.USER_THREAD = Platform::runLater;
    // Create the app kit. It won't do any heavyweight initialization until after we start it.
    bitcoin = new WalletAppKit(params, new File("."), filePrefix + APP_NAME) {

        @Override
        protected void addWalletExtensions() throws Exception {
            super.addWalletExtensions();
            wallet().addExtension(new StoredPaymentChannelClientStates(wallet(), peerGroup()));
        }
    };
    if (params == RegTestParams.get()) {
        // You should run a regtest mode bitcoind locally.
        bitcoin.connectToLocalHost();
    } else if (params == MainNetParams.get()) {
        // Checkpoints are block headers that ship inside our app: for a new user, we pick the last header
        // in the checkpoints file and then download the rest from the network. It makes things much faster.
        // Checkpoint files are made using the BuildCheckpoints tool and usually we have to download the
        // last months worth or more (takes a few seconds).
        bitcoin.setCheckpoints(getClass().getResourceAsStream("checkpoints"));
    }
    // Now configure and start the appkit. It won't block for very long.
    bitcoin.setDownloadListener(controller.progressBarUpdater()).setBlockingStartup(false).setUserAgent("PayFile Client", "1.0").startAndWait();
    // Don't make the user wait for confirmations for now, as the intention is they're sending it their own money!
    bitcoin.wallet().allowSpendingUnconfirmedTransactions();
    System.out.println(bitcoin.wallet());
    controller.onBitcoinSetup();
    overlayUI("connect_server.fxml");
    mainUI.setVisible(false);
    mainWindow.show();
}
Also used : Platform(javafx.application.Platform) StoredPaymentChannelClientStates(com.google.bitcoin.protocols.channels.StoredPaymentChannelClientStates) WalletAppKit(com.google.bitcoin.kits.WalletAppKit) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) File(java.io.File) URL(java.net.URL) StackPane(javafx.scene.layout.StackPane) OptionException(joptsimple.OptionException) IOException(java.io.IOException) BlockStoreException(com.google.bitcoin.store.BlockStoreException)

Example 44 with StackPane

use of javafx.scene.layout.StackPane in project FXyzLib by Birdasaur.

the class OctahedronTest method start.

@Override
public void start(Stage stage) {
    shapeGroup.getChildren().clear();
    generateShapes();
    root.getChildren().add(shapeGroup);
    camera = new AdvancedCamera();
    controller = new FPSController();
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);
    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);
    controller.setScene(scene);
    scene.setOnKeyPressed(event -> {
        KeyCode keycode = event.getCode();
        if (keycode == KeyCode.SPACE) {
            shapeGroup.getChildren().clear();
            generateShapes();
        }
    });
    stage.setTitle("Random Octahedrons!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(false);
    stage.setFullScreenExitHint("");
}
Also used : AdvancedCamera(org.fxyz.cameras.AdvancedCamera) FPSController(org.fxyz.cameras.controllers.FPSController) KeyCode(javafx.scene.input.KeyCode) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 45 with StackPane

use of javafx.scene.layout.StackPane in project FXyzLib by Birdasaur.

the class SpheroidTest method start.

@Override
public void start(Stage stage) {
    Group spheroidGroup = new Group();
    for (int i = 0; i < 50; i++) {
        Random r = new Random();
        //A lot of magic numbers in here that just artificially constrain the math
        float randomMajorRadius = (float) ((r.nextFloat() * 300) + 50);
        float randomMinorRadius = (float) ((r.nextFloat() * 300) + 50);
        int randomDivisions = (int) ((r.nextFloat() * 64) + 1);
        Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
        Spheroid sm = new Spheroid(randomDivisions, randomMajorRadius, randomMinorRadius, randomColor);
        sm.setDrawMode(DrawMode.LINE);
        double translationX = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationX *= -1;
        }
        double translationY = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationY *= -1;
        }
        double translationZ = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationZ *= -1;
        }
        Translate translate = new Translate(translationX, translationY, translationZ);
        Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
        Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
        Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
        sm.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
        spheroidGroup.getChildren().add(sm);
    }
    root.getChildren().add(spheroidGroup);
    System.out.println(spheroidGroup.getChildren().size());
    camera = new PerspectiveCamera(true);
    cameraTransform.setTranslate(0, 0, 0);
    cameraTransform.getChildren().addAll(camera);
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setTranslateZ(cameraDistance);
    cameraTransform.ry.setAngle(-45.0);
    cameraTransform.rx.setAngle(-10.0);
    //add a Point Light for better viewing of the grid coordinate system
    PointLight light = new PointLight(Color.WHITE);
    cameraTransform.getChildren().add(light);
    light.setTranslateX(camera.getTranslateX());
    light.setTranslateY(camera.getTranslateY());
    light.setTranslateZ(camera.getTranslateZ());
    root.getChildren().add(cameraTransform);
    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);
    initFirstPersonControls(scene);
    stage.setTitle("Hello World!");
    stage.setScene(scene);
    stage.show();
}
Also used : Group(javafx.scene.Group) Rotate(javafx.scene.transform.Rotate) Color(javafx.scene.paint.Color) Spheroid(org.fxyz.shapes.Spheroid) PerspectiveCamera(javafx.scene.PerspectiveCamera) Scene(javafx.scene.Scene) Random(java.util.Random) PointLight(javafx.scene.PointLight) Translate(javafx.scene.transform.Translate) StackPane(javafx.scene.layout.StackPane)

Aggregations

StackPane (javafx.scene.layout.StackPane)65 Scene (javafx.scene.Scene)36 Insets (javafx.geometry.Insets)15 BorderPane (javafx.scene.layout.BorderPane)12 Label (javafx.scene.control.Label)10 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 ArrayList (java.util.ArrayList)5 Platform (javafx.application.Platform)5 MapPaneCtrl (aimax.osm.gui.fx.viewer.MapPaneCtrl)4 List (java.util.List)4 Node (javafx.scene.Node)4 Button (javafx.scene.control.Button)4 KeyCode (javafx.scene.input.KeyCode)4 Pane (javafx.scene.layout.Pane)4 Color (javafx.scene.paint.Color)4 WebView (javafx.scene.web.WebView)4