Package javafx.scene.layout

Examples of javafx.scene.layout.GridPane


    @Override public void init() {
    }

    @Override public void start(Stage stage) {
        GridPane pane = new GridPane();
        for (int y = 0 ; y < 20 ; y++) {
            for (int x = 0 ; x < 20 ; x++) {
                pane.add(LedBuilder.create()
                                   .ledColor(Color.rgb(RND.nextInt(255), RND.nextInt(255), RND.nextInt(255)))
                                   .frameVisible(false)
                                   .interval(500_000_000l)
                                   .blinking(true)
                                   .build(), x, y);
            }
        }
        pane.sceneProperty().addListener(observable -> start = LocalTime.now());

        Scene scene = new Scene(pane);

        stage.setTitle("Led demo");
        stage.setScene(scene);
View Full Code Here


    @Override public void init() {
    }

    @Override public void start(Stage stage) {
        GridPane pane = new GridPane();
        for (int y = 0 ; y < 20 ; y++) {
            for (int x = 0 ; x < 20 ; x++) {
                pane.add(LedBuilder.create()
                                   .ledColor(Color.rgb(RND.nextInt(255), RND.nextInt(255), RND.nextInt(255)))
                                   .frameVisible(false)
                                   .interval(500_000_000l)
                                   .blinking(true)
                                   .build(), x, y);
            }
        }
        pane.sceneProperty().addListener(observable -> start = LocalTime.now());

        Scene scene = new Scene(pane);

        stage.setTitle("Led demo");
        stage.setScene(scene);
View Full Code Here

    @Override public void init() {
    }

    @Override public void start(Stage stage) {
        GridPane pane = new GridPane();
        for (int y = 0; y < 20; y++) {
            for (int x = 0; x < 20; x++) {
                pane.add(new Led(Color.rgb(RND.nextInt(255), RND.nextInt(255), RND.nextInt(255)),
                                   false,
                                   500_000_000l,
                                   true)
                                   , x, y);
            }
        }
        pane.sceneProperty().addListener(observable -> start = LocalTime.now());

        Scene scene = new Scene(pane);

        stage.setTitle("Led demo");
        stage.setScene(scene);
View Full Code Here

        dutch   = QlockTwoBuilder.create().prefSize(400, 400).language(QlockTwo.Language.DUTCH).color(QlockTwo.QlockColor.LIME_JUICE).build();
        german1 = QlockTwoBuilder.create().secondsMode(true).prefSize(400, 400).language(QlockTwo.Language.GERMAN).color(QlockTwo.QlockColor.STAINLESS_STEEL).build();
    }

    @Override public void start(Stage stage) {
        GridPane pane = new GridPane();
        pane.setHgap(10);
        pane.setVgap(10);
        pane.add(german, 0, 0);
        pane.add(english, 1, 0);
        pane.add(french, 2, 0);
        pane.add(spanish, 0, 1);
        pane.add(dutch, 1, 1);
        pane.add(german1, 2, 1);

        Scene scene = new Scene(pane, Color.DARKGRAY);

        stage.setTitle("JavaFX QlockTwo");
        stage.setScene(scene);
View Full Code Here

            //title1.setGraphic(new ImageView(image));
            title1.setTextFill(Color.web("#d0c0ff"));
            title2.setTextFill(Color.web("#fafafa"));

            //
            GridPane grid = new GridPane();
            grid.setVgap(5);
            grid.setHgap(5);
            GridPane.setConstraints(title1, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.NEVER, Priority.SOMETIMES);           
            GridPane.setConstraints(locationField, 1, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
            GridPane.setConstraints(goButton, 2, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.NEVER, Priority.SOMETIMES);
            GridPane.setConstraints(title2, 3, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.NEVER, Priority.SOMETIMES);
            GridPane.setConstraints(textVBox, 1, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
            GridPane.setConstraints(view, 1, 2, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
            GridPane.setConstraints(vBox, 0, 1, 1, 2, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
            GridPane.setConstraints(vBoxRight, 3, 1, 1, 2, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
            GridPane.setConstraints(statusField, 0, 3, 4, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
            grid.getColumnConstraints().addAll(
                    new ColumnConstraints(200,200,200, Priority.NEVER, HPos.RIGHT, true),
                    new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
                    new ColumnConstraints(100,100,100, Priority.NEVER, HPos.RIGHT, true),
                    new ColumnConstraints(200,200,200, Priority.NEVER, HPos.RIGHT, true)
            );
            grid.getChildren().addAll(title1, vBox, locationField, goButton, title2, textVBox, view, vBoxRight, statusField);
            RowConstraints row1 = new RowConstraints();
            row2 = new RowConstraints();
            row3 = new RowConstraints();
            RowConstraints row4 = new RowConstraints();
            row1.setMaxHeight(30);
            row1.setMinHeight(30);
            row1.setVgrow(Priority.ALWAYS);
            vBox.setMinHeight(100);
            textVBox.setMaxHeight(0);
            row2.setMaxHeight(0);
            row3.setPrefHeight(USE_COMPUTED_SIZE);           
            //row3.setFillHeight(true);
            row3.setVgrow(Priority.SOMETIMES);
            row4.setMaxHeight(40);
            row4.setMinHeight(40);
            row4.setFillHeight(true);
            //grid.setGridLinesVisible(true);
            grid.getRowConstraints().addAll(row1,row2,row3, row4);
            getChildren().add(grid);
           
       
        }
View Full Code Here

    @Override
    public void start(Stage mainStage) throws Exception {
        // Title
        mainStage.setTitle("Text Twist Ceheat");
        // Grid Layout
        GridPane pane = new GridPane(); // init grid
        pane.setAlignment(Pos.CENTER); // center element
       
        pane.setVgap(10);// vertical gap
        pane.setHgap(10);// horizontal gap
       
        pane.setPadding(new Insets(25, 25, 25, 25));
       
        // Scene
        Scene scene = new Scene(pane, 300, 275);// init scene
        // Welcome message
        Text sceneTitle = new Text("Text Twist Cheat"); // init text title
        sceneTitle.setFont(Font.font("Arial", FontWeight.NORMAL, 20)); // style title
        pane.add(sceneTitle, 0, 0, 2, 1); // add title to pane
        mainStage.setScene(scene); // set the scene
       
        mainStage.show();
    }
View Full Code Here

    final DoubleProperty radiusRatio = new SimpleDoubleProperty(0.5);
    final DoubleProperty viewDistanceRatio = new SimpleDoubleProperty(0.5);
    final DoubleProperty density = new SimpleDoubleProperty(0.01);
    final DoubleProperty cellSizeRatio = new SimpleDoubleProperty(0.6);

    GridPane gridPane = new GridPane();

    gridPane.add(new Label("Alignment (0.0 - 1.0)"), 1, 1);
    gridPane.add(new Slider(0.0, 1.0, 0.8) {{
      valueProperty().bindBidirectional(alignment);
      setBlockIncrement(0.1);
    }}, 2, 1);
    gridPane.add(new Label() {{
      textProperty().bind(alignment.asString("%4.2f"));
    }}, 3, 1);

    gridPane.add(new CheckBox("Reflection?") {{
      selectedProperty().bindBidirectional(reflectionEnabled);
    }}, 2, 2);

    gridPane.add(new CheckBox("Clip Reflections?") {{
      selectedProperty().bindBidirectional(clipReflections);
    }}, 2, 3);

    gridPane.add(new Label("fieldOfViewRatio (0.0 - 2.0)"), 1, 4);
    gridPane.add(new Slider(0.0, 2.0, 0.5) {{
      valueProperty().bindBidirectional(fieldOfViewRatio);
      setBlockIncrement(0.1);
    }}, 2, 4);
    gridPane.add(new Label() {{
      textProperty().bind(fieldOfViewRatio.asString("%4.2f"));
    }}, 3, 4);

    gridPane.add(new Label("radiusRatio (0.0 - 2.0)"), 1, 5);
    gridPane.add(new Slider(0.0, 2.0, 0.5) {{
      valueProperty().bindBidirectional(radiusRatio);
      setBlockIncrement(0.1);
    }}, 2, 5);
    gridPane.add(new Label() {{
      textProperty().bind(radiusRatio.asString("%4.2f"));
    }}, 3, 5);

    gridPane.add(new Label("viewDistanceRatio (0.0 - 4.0)"), 1, 6);
    gridPane.add(new Slider(0.0, 4.0, 0.5) {{
      valueProperty().bindBidirectional(viewDistanceRatio);
      setBlockIncrement(0.1);
    }}, 2, 6);
    gridPane.add(new Label() {{
      textProperty().bind(viewDistanceRatio.asString("%4.2f"));
    }}, 3, 6);

    gridPane.add(new Label("density (0.001 - 0.1)"), 1, 7);
    gridPane.add(new Slider(0.001, 0.1, 0.01) {{
      valueProperty().bindBidirectional(density);
      setBlockIncrement(0.0025);
    }}, 2, 7);
    gridPane.add(new Label() {{
      textProperty().bind(density.asString("%6.4f"));
    }}, 3, 7);

    gridPane.add(new Label("cellSizeRatio (0.1 - 1.0)"), 1, 8);
    gridPane.add(new Slider(0.1, 1.0, 0.6) {{
      valueProperty().bindBidirectional(cellSizeRatio);
      setBlockIncrement(0.05);
    }}, 2, 8);
    gridPane.add(new Label() {{
      textProperty().bind(cellSizeRatio.asString("%4.2f"));
    }}, 3, 8);

    carousel.cellAlignmentProperty().bind(alignment);
    carousel.reflectionEnabledProperty().bind(reflectionEnabled);
View Full Code Here

        TextField uText = TextFieldBuilder.create().id("uname").build();
        TextField pText = PasswordFieldBuilder.create().id("pword").build();
        Label u = LabelBuilder.create().text("User name").labelFor(uText).build();
        Label p = LabelBuilder.create().text("Password").labelFor(pText).build();

        GridPane grid = new GridPane();
        grid.add(u, 0, 0);
        grid.add(uText, 1, 0);
        grid.add(p, 0, 1);
        grid.add(pText, 1, 1);
        return grid;
    }
View Full Code Here

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("JavaFX BigDecimalField Demo");
        ObjectProperty<DateFormat> dateFormatProperty = new SimpleObjectProperty<>(DateFormat.getDateInstance());
        ObjectProperty<NumberFormat> numberFormatProperty = new SimpleObjectProperty<>(NumberFormat.getNumberInstance());
        GridPane root = new GridPane();
        root.setHgap(10);
        root.setVgap(10);
        root.setPadding(new Insets(10, 10, 10, 10));
        final BigDecimalField defaultSpinner = new BigDecimalField();
        final BigDecimalField decimalFormat = new BigDecimalField(BigDecimal.ZERO, new BigDecimal("0.05"), new DecimalFormat("#,##0.00"));
        final BigDecimalField percent = new BigDecimalField(BigDecimal.ZERO, new BigDecimal("0.01"), NumberFormat.getPercentInstance());
        final BigDecimalField localizedCurrency = new BigDecimalField(BigDecimal.ZERO, new BigDecimal("0.01"), NumberFormat.getCurrencyInstance(Locale.UK));
        final BigDecimalField promptText = new BigDecimalField();
        promptText.setNumber(null);
        promptText.setPromptText("Enter something");
        int rowIndex = 1;
        root.addRow(rowIndex++, new Label("default"), defaultSpinner);
        root.addRow(rowIndex++, new Label("custom decimal format"), decimalFormat);
        root.addRow(rowIndex++, new Label("percent"), percent);
        root.addRow(rowIndex++, new Label("localized currency"), localizedCurrency);
        final BigDecimalField disabledField = new BigDecimalField();
        disabledField.setDisable(true);
        root.addRow(rowIndex++, new Label("disabled field"), disabledField);
        root.addRow(rowIndex++, new Label("regular TextField"), new TextField("1.000,1234"));
        root.addRow(rowIndex++, new Label("with promptText"), promptText);
        CalendarTextField calendarTextField = new CalendarTextField();
        root.addRow(rowIndex++, new Label("CalendarTextField"), calendarTextField);
        ComboBox<Locale> cmbLocales = new ComboBox<>(FXCollections.observableArrayList(Locale.GERMANY, Locale.UK, Locale.FRANCE));
        cmbLocales.setOnAction(event -> {
            dateFormatProperty.set(DateFormat.getDateInstance(DateFormat.MEDIUM, cmbLocales.getValue()));
            numberFormatProperty.set(NumberFormat.getNumberInstance(cmbLocales.getValue()));
        });
        root.addRow(rowIndex++, new Label("Locale"), cmbLocales);

        root.addRow(rowIndex++, new Label("Field with boundaries (0,100%)"),
                BigDecimalFieldBuilder.create()
                        .number(new BigDecimal("0.1"))
                        .minValue(BigDecimal.ZERO)
                        .maxValue(BigDecimal.ONE)
                        .stepwidth(new BigDecimal("0.01"))
                        .format(DecimalFormat.getPercentInstance())
                        .build()
        );

        promptText.numberProperty().addListener(new ChangeListener<BigDecimal>() {
            @Override
            public void changed(ObservableValue<? extends BigDecimal> observableValue, BigDecimal o, BigDecimal o1) {
                System.out.println(o1);
            }
        });

        Button button = new Button("Reset fields");
        button.setOnAction((ActionEvent event) -> {
            defaultSpinner.setNumber(new BigDecimal(Math.random() * 1000));
            decimalFormat.setNumber(new BigDecimal(Math.random() * 1000));
            percent.setNumber(new BigDecimal(Math.random()));
            localizedCurrency.setNumber(new BigDecimal(Math.random() * 1000));
            disabledField.setNumber(new BigDecimal(Math.random() * 1000));
            promptText.setNumber(null);
            calendarTextField.setCalendar(Calendar.getInstance());
            decimalFormat.requestFocus();
        });
        root.addRow(rowIndex++, new Label(), button);
        BigDecimalLabel bigDecimalLabel = new BigDecimalLabel();
        bigDecimalLabel.numberProperty().bind(defaultSpinner.numberProperty());
        bigDecimalLabel.formatProperty().bind(numberFormatProperty);
        root.addRow(rowIndex++, new Label("BigDecimalLabel"), bigDecimalLabel);

        CalendarLabel calendarLabel = new CalendarLabel();
        calendarLabel.valueProperty().bind(calendarTextField.calendarProperty());
        calendarLabel.formatProperty().bind(dateFormatProperty);
        root.addRow(rowIndex++, new Label("CalendarLabel"), calendarLabel);
//        defaultSpinner.requestFocus();
//        calendarTextField.requestFocus();
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
View Full Code Here

        MagnifierDemo.class.getResourceAsStream("/jfxtras/labs/scene/control/magnifier-sample2.jpg")));
    sample2.setFitHeight(420);
    sample2.setFitWidth(500);
    samples.put(2, configureSample(sample2));

    GridPane gp = new GridPane();
    gp.setVgap(8);
    gp.setHgap(10);
    gp.addRow(0, new Label("First Name"), new Label(":"), new TextField());
    gp.addRow(1, new Label("Last Name"), new Label(":"), new TextField());
    gp.addRow(2, new Label("Gender"), new Label(":"), new RadioButton("Male"));
    gp.addRow(3, new Label(""), new Label(""), new RadioButton("Female"));
    gp.addRow(4, new Label("Subjects"), new Label(":"), new CheckBox("Maths"), new CheckBox("Social"));
    gp.addRow(5, new Label(""), new Label(""), new CheckBox("Science"), new CheckBox("Biology"));

    HBox formButtonBox = new HBox();
    formButtonBox.setSpacing(10);
    formButtonBox.setPadding(new Insets(15, 0, 0, 0));
    formButtonBox.setAlignment(Pos.CENTER_RIGHT);
View Full Code Here

TOP

Related Classes of javafx.scene.layout.GridPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.