Java 类javafx.geometry.VPos 实例源码

项目:incubator-netbeans    文件:KeyStrokeMotion.java   
private void createLetter(String c) {
    final Text letter = new Text(c);
    letter.setFill(Color.BLACK);
    letter.setFont(FONT_DEFAULT);
    letter.setTextOrigin(VPos.TOP);
    letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
    letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
    getChildren().add(letter);
    // over 3 seconds move letter to random position and fade it out
    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(
            new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent event) {
                    // we are done remove us from scene
                    getChildren().remove(letter);
                }
            },
            new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
            new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
            new KeyValue(letter.opacityProperty(), 0f)
    ));
    timeline.play();
}
项目:marathonv5    文件:KeyStrokeMotion.java   
private void createLetter(String c) {
    final Text letter = new Text(c);
    letter.setFill(Color.BLACK);
    letter.setFont(FONT_DEFAULT);
    letter.setTextOrigin(VPos.TOP);
    letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
    letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
    getChildren().add(letter);
    // over 3 seconds move letter to random position and fade it out
    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(
            new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent event) {
                    // we are done remove us from scene
                    getChildren().remove(letter);
                }
            },
            new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
            new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
            new KeyValue(letter.opacityProperty(), 0f)
    ));
    timeline.play();
}
项目:marathonv5    文件:KeyStrokeMotion.java   
private void createLetter(String c) {
    final Text letter = new Text(c);
    letter.setFill(Color.BLACK);
    letter.setFont(FONT_DEFAULT);
    letter.setTextOrigin(VPos.TOP);
    letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
    letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
    getChildren().add(letter);
    // over 3 seconds move letter to random position and fade it out
    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(
            new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent event) {
                    // we are done remove us from scene
                    getChildren().remove(letter);
                }
            },
            new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
            new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
            new KeyValue(letter.opacityProperty(), 0f)
    ));
    timeline.play();
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureDigits() {
    for (int i : numbers) {
        digits[i] = new Text("0");
        digits[i].setFont(FONT);
        digits[i].setTextOrigin(VPos.TOP);
        digits[i].setLayoutX(2.3);
        digits[i].setLayoutY(-1);
        Rectangle background;
        if (i < 6) {
            background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
            digits[i].setFill(Color.web("#000000"));
        } else {
            background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
            digits[i].setFill(Color.web("#FFFFFF"));
        }
        digitsGroup[i] = new Group(background, digits[i]);
    }
}
项目:marathonv5    文件:Sample.java   
@Override protected void layoutChildren() {
    if (isFixedSize) {
        super.layoutChildren();
    } else {
        List<Node> managed = getManagedChildren();
        double width = getWidth();
        ///System.out.println("width = " + width);
        double height = getHeight();
        ///System.out.println("height = " + height);
        double top = getInsets().getTop();
        double right = getInsets().getRight();
        double left = getInsets().getLeft();
        double bottom = getInsets().getBottom();
        for (int i = 0; i < managed.size(); i++) {
            Node child = managed.get(i);
            layoutInArea(child, left, top,
                           width - left - right, height - top - bottom,
                           0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
        }
    }
}
项目:marathonv5    文件:HTMLEditorSample.java   
public static Node createIconContent() {

        Text htmlStart = new Text("<html>");
        Text htmlEnd = new Text("</html>");
        htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlStart.setStyle("-fx-font-size: 20px;");
        htmlStart.setTextOrigin(VPos.TOP);
        htmlStart.setLayoutY(11);
        htmlStart.setLayoutX(20);

        htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlEnd.setStyle("-fx-font-size: 20px;");
        htmlEnd.setTextOrigin(VPos.TOP);
        htmlEnd.setLayoutY(31);
        htmlEnd.setLayoutX(20);

        return new Group(htmlStart, htmlEnd);
    }
项目:marathonv5    文件:StopWatchSample.java   
private void configureDigits() {
    for (int i : numbers) {
        digits[i] = new Text("0");
        digits[i].setFont(FONT);
        digits[i].setTextOrigin(VPos.TOP);
        digits[i].setLayoutX(2.3);
        digits[i].setLayoutY(-1);
        Rectangle background;
        if (i < 6) {
            background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
            digits[i].setFill(Color.web("#000000"));
        } else {
            background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
            digits[i].setFill(Color.web("#FFFFFF"));
        }
        digitsGroup[i] = new Group(background, digits[i]);
    }
}
项目:marathonv5    文件:StringBindingSample.java   
public static Node createIconContent() {
    Text text = new Text("abc");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(10);
    text.setLayoutY(11);
    text.setFill(Color.BLACK);
    text.setOpacity(0.5);
    text.setFont(Font.font(null, FontWeight.BOLD, 20));
    text.setStyle("-fx-font-size: 20px;");

    Text text2 = new Text("abc");
    text2.setTextOrigin(VPos.TOP);
    text2.setLayoutX(28);
    text2.setLayoutY(51);
    text2.setFill(Color.BLACK);
    text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
    text2.setStyle("-fx-font-size: 20px;");

    Line line = new Line(30, 32, 45, 57);
    line.setStroke(Color.DARKMAGENTA);

    return new javafx.scene.Group(text, line, text2);
}
项目:marathonv5    文件:FormPane.java   
public FormPane addFormField(String text, Node... fields) {
    Label label = new Label(text);
    String labelId = idText(text);
    label.setId(labelId);
    GridPane.setValignment(label, VPos.TOP);
    int column = 0;
    add(label, column++, currentRow, 1, 1);
    int colspan = columns - fields.length;
    int fieldIndex = 1;
    for (Node field : fields) {
        field.setId(labelId + "-field-" + fieldIndex);
        setFormConstraints(field);
        GridPane.setValignment(field, VPos.TOP);
        add(field, column++, currentRow, colspan, 1);
        fieldIndex++;
    }
    currentRow++;
    column = 0;
    return this;
}
项目:marathonv5    文件:Sample.java   
@Override protected void layoutChildren() {
    if (isFixedSize) {
        super.layoutChildren();
    } else {
        List<Node> managed = getManagedChildren();
        double width = getWidth();
        ///System.out.println("width = " + width);
        double height = getHeight();
        ///System.out.println("height = " + height);
        double top = getInsets().getTop();
        double right = getInsets().getRight();
        double left = getInsets().getLeft();
        double bottom = getInsets().getBottom();
        for (int i = 0; i < managed.size(); i++) {
            Node child = managed.get(i);
            layoutInArea(child, left, top,
                           width - left - right, height - top - bottom,
                           0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
        }
    }
}
项目:marathonv5    文件:HTMLEditorSample.java   
public static Node createIconContent() {

        Text htmlStart = new Text("<html>");
        Text htmlEnd = new Text("</html>");
        htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlStart.setStyle("-fx-font-size: 20px;");
        htmlStart.setTextOrigin(VPos.TOP);
        htmlStart.setLayoutY(11);
        htmlStart.setLayoutX(20);

        htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlEnd.setStyle("-fx-font-size: 20px;");
        htmlEnd.setTextOrigin(VPos.TOP);
        htmlEnd.setLayoutY(31);
        htmlEnd.setLayoutX(20);

        return new Group(htmlStart, htmlEnd);
    }
项目:marathonv5    文件:StopWatchSample.java   
private void configureDigits() {
    for (int i : numbers) {
        digits[i] = new Text("0");
        digits[i].setFont(FONT);
        digits[i].setTextOrigin(VPos.TOP);
        digits[i].setLayoutX(2.3);
        digits[i].setLayoutY(-1);
        Rectangle background;
        if (i < 6) {
            background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
            digits[i].setFill(Color.web("#000000"));
        } else {
            background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
            digits[i].setFill(Color.web("#FFFFFF"));
        }
        digitsGroup[i] = new Group(background, digits[i]);
    }
}
项目:marathonv5    文件:StringBindingSample.java   
public static Node createIconContent() {
    Text text = new Text("abc");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(10);
    text.setLayoutY(11);
    text.setFill(Color.BLACK);
    text.setOpacity(0.5);
    text.setFont(Font.font(null, FontWeight.BOLD, 20));
    text.setStyle("-fx-font-size: 20px;");

    Text text2 = new Text("abc");
    text2.setTextOrigin(VPos.TOP);
    text2.setLayoutX(28);
    text2.setLayoutY(51);
    text2.setFill(Color.BLACK);
    text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
    text2.setStyle("-fx-font-size: 20px;");

    Line line = new Line(30, 32, 45, 57);
    line.setStroke(Color.DARKMAGENTA);

    return new javafx.scene.Group(text, line, text2);
}
项目:dynamo    文件:TransformerSkin.java   
private void resize() {
    width  = getSkinnable().getWidth();
    height = getSkinnable().getHeight();

    if (width > 0 && height > 0) {
        size    = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();

        background.setPrefSize(width, height);
        transformer.setPrefSize(width, height);

        name.setText(getSkinnable().getName());
        name.setFont(Font.font(size*NAME_TEXT_SIZE_FACTOR));
        name.setX((size - name.getLayoutBounds().getWidth()) * 0.5);
        name.setY((size - name.getLayoutBounds().getHeight()) * 0.5);
        name.setTextOrigin(VPos.TOP);
        updateState();
    }
}
项目:dynamo    文件:DisplaySkin.java   
private void resize() {
    width  = getSkinnable().getWidth();
    height = getSkinnable().getHeight();
    size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();

    if (width > 0 && height > 0) {
        updateFonts();                                                                          // Set fonts size

        warningIcon.setPrefSize(width*0.12, height*0.3);

        titleText.setTextOrigin(VPos.TOP);
        titleText.setTextAlignment(TextAlignment.CENTER);
        titleText.setText(getSkinnable().getTitle());
        titleText.setX((width - titleText.getLayoutBounds().getWidth()) * 0.5);                         // In the middle

        background.setPrefSize(width, (height -(titleText.getLayoutBounds().getHeight())));
        background.setTranslateY((height - (height - titleText.getLayoutBounds().getHeight())));    // Under the titleText

        frame.setPrefSize(width, titleText.getLayoutBounds().getHeight());
        frame.setTranslateY(height - (height - titleText.getLayoutBounds().getHeight()));           // With background

        updateDisplay();                                                                      // Inside the frame
    }
}
项目:dynamo    文件:LoadSkin.java   
private void resize() {
    width  = getSkinnable().getWidth();
    height = getSkinnable().getHeight();

    if (width > 0 && height > 0) {
        size    = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();

        background.setPrefSize(width, height);
        load.setPrefSize(width, height);

        name.setText(getSkinnable().getName());
        name.setFont(Font.font(size*NAME_TEXT_SIZE_FACTOR));
        name.setX((size - name.getLayoutBounds().getWidth()) * 0.5);
        name.setY((size - name.getLayoutBounds().getHeight()) * 0.5);
        name.setTextOrigin(VPos.TOP);
        updateState();
    }
}
项目:dynamo    文件:LevelBarSkin.java   
private void updatePointer() {
    currentValueText.setText(formatCurrentValue(getSkinnable().getCurrentValue(), getSkinnable().getDecimals()));
    currentValueText.setFont(Font.font("Digital-7", width * CURRENT_VALUE_FONT_SIZE_FACTOR));
    currentValueText.setTextOrigin(VPos.TOP);
    currentValueText.setTextAlignment(TextAlignment.RIGHT);

    currentValuePointer.getStyleClass().clear();
    currentValuePointer.getStyleClass().setAll("normal-current-value-pointer");
    currentValuePointer.setPrefSize(currentValueText.getLayoutBounds().getWidth()*1.10, currentValueText.getLayoutBounds().getHeight()*1.10);
    currentValuePointerGroup.setTranslateX((width/2 + barWidth/2) - currentValuePointerGroup.getLayoutBounds().getWidth());

    final double newPosition =  getSkinnable().getCurrentValue() < getSkinnable().getMinValue() ? height - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) :
                                getSkinnable().getCurrentValue() > getSkinnable().getMaxValue() ? height - barHeight - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) :
                                height - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) - (barHeight * (getSkinnable().getCurrentValue()-getSkinnable().getMinValue()) / (getSkinnable().getMaxValue()-getSkinnable().getMinValue()));

    if(getSkinnable().getAnimated()){
        timeline.stop();
        final KeyValue KEY_VALUE = new KeyValue(currentValuePointerGroup.translateYProperty(), newPosition, Interpolator.EASE_BOTH);
        final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
        timeline.getKeyFrames().setAll(KEY_FRAME);
        timeline.play();
    }else {
        currentValuePointerGroup.setTranslateY(newPosition);
    }
}
项目:WeatherWatch    文件:NotificationPane.java   
private void setupView() {
    ImageView weatherIcon = new ImageView();
    weatherIcon.setImage(weatherEvent.getForecast().getWeather().getIcon());
    weatherIcon.fitWidthProperty().bind(stage.widthProperty().divide(3));
    weatherIcon.fitHeightProperty().bind(stage.heightProperty().multiply(1));
    GridPane.setHgrow(weatherIcon, Priority.ALWAYS);
    GridPane.setVgrow(weatherIcon, Priority.ALWAYS);
    GridPane.setHalignment(weatherIcon, HPos.CENTER);
    GridPane.setValignment(weatherIcon, VPos.CENTER);
    add(weatherIcon, 0, 0);

    Text txt_weather_event = new Text();
    txt_weather_event.setText(controller.getWeatherEventText());
    GridPane.setHgrow(txt_weather_event, Priority.ALWAYS);
    GridPane.setVgrow(txt_weather_event, Priority.ALWAYS);
    GridPane.setValignment(txt_weather_event, VPos.CENTER);
    add(txt_weather_event, 1, 0);
}
项目:redisfx    文件:FormDialog.java   
private GridPane getContentPane() {
    contentPane.setHgap(10);
    contentPane.setVgap(10);

    // top-align all child nodes
    contentPane.getChildren().addListener((ListChangeListener<Node>) c -> {
        while (c.next()) {
            if (c.wasAdded()) {
                c.getAddedSubList().forEach(node ->
                        GridPane.setValignment(node, VPos.TOP));
            }
        }
    });

    ColumnConstraints titleCC = new ColumnConstraints();
    titleCC.setPrefWidth(100);

    ColumnConstraints valueCC = new ColumnConstraints();
    valueCC.setFillWidth(true);
    valueCC.setHgrow(Priority.ALWAYS);

    contentPane.getColumnConstraints().addAll(titleCC, valueCC);

    VBox.setVgrow(contentPane, Priority.ALWAYS);
    return contentPane;
}
项目:sankeyplot    文件:SankeyPlot.java   
private void resize() {
    width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
    height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    size   = width < height ? width : height;

    if (width > 0 && height > 0) {
        canvas.setWidth(width);
        canvas.setHeight(height);
        canvas.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);

        ctx.setTextBaseline(VPos.CENTER);
        ctx.setFont(Font.font(Helper.clamp(8, 24, size * 0.025)));

        prepareData();
    }
}
项目:charts    文件:CoxcombChart.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    getStyleClass().add("coxcomb-chart");

    popup = new InfoPopup();

    canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ctx    = canvas.getGraphicsContext2D();

    ctx.setLineCap(StrokeLineCap.BUTT);
    ctx.setTextBaseline(VPos.CENTER);
    ctx.setTextAlign(TextAlignment.CENTER);

    pane = new Pane(canvas);

    getChildren().setAll(pane);
}
项目:charts    文件:LegendItem.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    canvas = new Canvas(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
    ctx    = canvas.getGraphicsContext2D();
    ctx.setTextAlign(TextAlignment.LEFT);
    ctx.setTextBaseline(VPos.CENTER);

    pane   = new Pane(canvas);

    getChildren().setAll(pane);
}
项目:charts    文件:SankeyPlot.java   
private void resize() {
    width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
    height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    size   = width < height ? width : height;

    if (width > 0 && height > 0) {
        canvas.setWidth(width);
        canvas.setHeight(height);
        canvas.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);

        ctx.setTextBaseline(VPos.CENTER);
        ctx.setFont(Font.font(Helper.clamp(8, 24, size * 0.025)));

        prepareData();
    }
}
项目:charts    文件:AreaHeatMap.java   
private void drawDataPoints() {
    ctx.setTextAlign(TextAlignment.CENTER);
    ctx.setTextBaseline(VPos.CENTER);
    ctx.setFont(Font.font(size * 0.0175));

    for (int i = 0 ; i < points.size() ; i++) {
        DataPoint point = points.get(i);

        ctx.setFill(Color.rgb(255, 255, 255, 0.5));
        ctx.fillOval(point.getX() - 8, point.getY() - 8, 16, 16);

        //ctx.setStroke(getUseColorMapping() ? getColorForValue(point.getValue(), 1) : getColorForValue(point.getValue(), isDiscreteColors()));
        ctx.setStroke(Color.BLACK);
        ctx.strokeOval(point.getX() - 8, point.getY() - 8, 16, 16);

        ctx.setFill(Color.BLACK);
        ctx.fillText(Long.toString(Math.round(point.getValue())), point.getX(), point.getY(), 16);
    }
}
项目:charts    文件:StreamChart.java   
private void resize() {
    width         = getWidth() - getInsets().getLeft() - getInsets().getRight();
    height        = getHeight() - getInsets().getTop() - getInsets().getBottom();
    reducedHeight = height - height * 0.05;
    size          = width < height ? width : height;

    if (width > 0 && height > 0) {
        canvas.setWidth(width);
        canvas.setHeight(height);
        canvas.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);

        ctx.setTextBaseline(VPos.CENTER);
        ctx.setFont(Font.font(Helper.clamp(8, 24, size * 0.025)));

        groupBy(getCategory());
    }
}
项目:tilesfx    文件:GaugeTileSkin.java   
@Override protected void resizeDynamicText() {
    double maxWidth = unitText.isManaged() ? width - size * 0.275 : width - size * 0.1;
    double fontSize = size * 0.24;
    valueText.setFont(Fonts.latoRegular(fontSize));
    if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); }

    fontSize = size * 0.1;
    unitText.setFont(Fonts.latoRegular(fontSize));
    if (unitText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(unitText, maxWidth, fontSize); }

    thresholdText.setFill(sectionsVisible ? Color.TRANSPARENT : tile.getBackgroundColor());
    if (!sectionsVisible) {
        fontSize = size * 0.08;
        thresholdText.setFont(Fonts.latoRegular(fontSize));
        thresholdText.setTextOrigin(VPos.CENTER);
        if (thresholdText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(thresholdText, maxWidth, fontSize); }
        thresholdText.setX((width - thresholdText.getLayoutBounds().getWidth()) * 0.5);
        thresholdText.setY(thresholdRect.getLayoutBounds().getMinY() + thresholdRect.getHeight() * 0.5);
    }
}
项目:binjr    文件:JrdsAdapterDialog.java   
/**
 * Initializes a new instance of the {@link JrdsAdapterDialog} class.
 *
 * @param owner the owner window for the dialog
 */
public JrdsAdapterDialog(Node owner) {
    super(owner, Mode.URL);
    this.parent.setHeaderText("Connect to a JRDS source");
    this.tabsChoiceBox = new ChoiceBox<>();
    tabsChoiceBox.getItems().addAll(JrdsTreeViewTab.values());
    this.extraArgumentTextField = new TextField();
    HBox.setHgrow(extraArgumentTextField, Priority.ALWAYS);
    HBox hBox = new HBox(tabsChoiceBox, extraArgumentTextField);
    hBox.setSpacing(10);
    GridPane.setConstraints(hBox, 1, 2, 1, 1, HPos.LEFT, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS, new Insets(4, 0, 4, 0));
    tabsChoiceBox.getSelectionModel().select(JrdsTreeViewTab.HOSTS_TAB);
    Label tabsLabel = new Label("Sorted By:");
    GridPane.setConstraints(tabsLabel, 0, 2, 1, 1, HPos.LEFT, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS, new Insets(4, 0, 4, 0));
    this.paramsGridPane.getChildren().addAll(tabsLabel, hBox);
    extraArgumentTextField.visibleProperty().bind(Bindings.createBooleanBinding(() -> this.tabsChoiceBox.valueProperty().get().getArgument() != null, this.tabsChoiceBox.valueProperty()));
}
项目:tilesfx    文件:BarChartItem.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
        Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    nameText = new Text(getName());
    nameText.setTextOrigin(VPos.TOP);

    valueText = new Text(String.format(locale, formatString, getValue()));
    valueText.setTextOrigin(VPos.TOP);

    barBackground = new Rectangle();

    bar = new Rectangle();

    pane = new Pane(nameText, valueText, barBackground, bar);
    pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
项目:tilesfx    文件:DonutChartTileSkin.java   
private void drawLegend() {
    List<ChartData> dataList     = tile.getChartData();
    double          canvasWidth  = legendCanvas.getWidth();
    double          canvasHeight = legendCanvas.getHeight();
    int             noOfItems    = dataList.size();
    //List<ChartData> sortedDataList = dataList.stream().sorted(Comparator.comparingDouble(ChartData::getValue).reversed()).collect(Collectors.toList());
    Color           textColor    = tile.getTextColor();
    double          stepSize     = canvasHeight * 0.9 / (noOfItems + 1);

    legendCtx.clearRect(0, 0, canvasWidth, canvasHeight);
    legendCtx.setTextAlign(TextAlignment.LEFT);
    legendCtx.setTextBaseline(VPos.CENTER);
    legendCtx.setFont(Fonts.latoRegular(canvasHeight * 0.05));

    for (int i = 0 ; i < noOfItems ; i++) {
        ChartData data = dataList.get(i);

        legendCtx.setFill(data.getFillColor());
        legendCtx.fillOval(0, (i + 1) * stepSize, size * 0.0375, size * 0.0375);
        legendCtx.setFill(textColor);
        legendCtx.fillText(data.getName(), size * 0.05, (i + 1) * stepSize + canvasHeight * 0.025);
    }
}
项目:sudoku-desktop-game    文件:global.java   
/**
 * Initialize button styles, icons sizes Muhammad Tarek
 * 
 * @param button
 * @param layout
 * @param position
 * @param icon
 */
static void initButtonStyle(Button button, GridPane layout, int position, ImageView icon, int bgColor) {
    button.getStyleClass().add("icon-text-button");

    if (icon != null) {
        icon.setFitHeight(bgColor == 1 ? 20 : 24);
        icon.setFitWidth(bgColor == 1 ? 20 : 24);
    }

    button.getStyleClass().add("button-icon_text");
    button.setAlignment(Pos.CENTER_LEFT);

    if (bgColor == 1) {
        button.getStyleClass().add("button-icon_text--transparent");
    } else {
        button.getStyleClass().add("button-icon_text--white");
    }

    layout.setConstraints(button, 0, position);
    layout.setHalignment(button, HPos.CENTER);
    layout.setValignment(button, VPos.CENTER);
    layout.getChildren().add(button);
}
项目:fictional-spoon    文件:PanelDecorator.java   
private void renderBottomPanel() {
    // clear screen
    GraphicsContext gc = gcs.get("bottom panel");
    gc.clearRect(0, 0, gc.getCanvas().getWidth(), gc.getCanvas().getHeight());

    // draw background
    gc.setFill(Global.DARKGRAY);
    gc.fillRect(0, 0, gc.getCanvas().getWidth(), gc.getCanvas().getHeight());
    gc.setFill(Global.WHITE);
    gc.fillRect(0, 5, gc.getCanvas().getWidth(), 2);

    // font settings
    gc.setFont(Global.DEFAULT_FONT);
    gc.setTextAlign(TextAlignment.CENTER);
    gc.setTextBaseline(VPos.CENTER);

    // print out text boxes
    gc.fillText("level " + level, Global.GAME_WIDTH * .2, 5 + (Global.PANEL_HEIGHT - 5) / 2);
    gc.fillText(life + " life", Global.GAME_WIDTH * .4, 5 + (Global.PANEL_HEIGHT - 5) / 2);
    gc.fillText("combos (C)", Global.GAME_WIDTH * .6, 5 + (Global.PANEL_HEIGHT - 5) / 2);
    gc.fillText("quest (Q)", Global.GAME_WIDTH * .8, 5 + (Global.PANEL_HEIGHT - 5) / 2);
}
项目:Gargoyle    文件:DateChooserSkin.java   
@Override
protected void layoutChildren() {
    ObservableList<Node> children = getChildren();
    double width = getWidth();
    double height = getHeight();

    double cellWidth = (width / (columns + 1));
    double cellHeight = height / (rows + 1);

    for (int i = 0; i < (rows + 1); i++) {
        for (int j = 0; j < (columns + 1); j++) {
            if (children.size() <= ((i * (columns + 1)) + j)) {
                break;
            }
            Node get = children.get((i * (columns + 1)) + j);
            layoutInArea(get, j * cellWidth, i * cellHeight, cellWidth, cellHeight, 0.0d, HPos.LEFT, VPos.TOP);
        }

    }
}
项目:Simulizer    文件:ListVisualiser.java   
public ListVisualiser(ListModel model, HighLevelVisualisation vis) {
    super(model, vis);
    this.model = model;
    list = model.getList();
    getChildren().add(canvas);

    canvas.widthProperty().bind(super.widthProperty());
    canvas.widthProperty().addListener(e -> Platform.runLater(this::repaint));
    canvas.heightProperty().bind(super.heightProperty());
    canvas.heightProperty().addListener(e -> Platform.runLater(this::repaint));

    GraphicsContext gc = canvas.getGraphicsContext2D();
    gc.setLineWidth(2);
    gc.setStroke(Color.BLACK);
    gc.setTextBaseline(VPos.CENTER);
    gc.setTextAlign(TextAlignment.CENTER);
}
项目:Gargoyle    文件:ImageViewPane.java   
@Override
protected void layoutChildren() {
    ImageView imageView = imageViewProperty.get();
    if (imageView != null) {
        double width = getWidth();
        double height = getHeight();
        if (width > height) {
            width = 5 / 3 * height;
        }

        double x = this.getPrefWidth() / 3.3 ;

        imageView.setFitWidth(width);
        imageView.setFitHeight(height);
        layoutInArea(imageView, x , 0, getWidth(), getHeight(), 0, HPos.CENTER, VPos.CENTER);
    }
     super.layoutChildren();
}
项目:gralog    文件:JavaFXGraphicsContext.java   
@Override
public void putText(double centerx, double centery, String text,
    double lineHeightCM, GralogColor c) {
    Point2D p1 = pane.modelToScreen(new Point2D(centerx, centery));

    Font font = gc.getFont();
    // I have no idea, why this is 1959.5... I hate magic numbers
    double newSize = 2.54d * lineHeightCM * pane.zoomFactor * 1959.5
        / (pane.screenResolutionY);
    gc.setFont(new Font(font.getName(), newSize));

    gc.setTextAlign(TextAlignment.CENTER);
    gc.setTextBaseline(VPos.CENTER);
    gc.setFill(Color.rgb(c.r, c.g, c.b));

    gc.fillText(text, p1.getX(), p1.getY());
}
项目:Simulizer    文件:CanvasModel.java   
/**
 * used internally to keep track of frames and display an FPS counter if requested
 */
private void submitFrame() {
    if(showFPS) {
        long now = System.currentTimeMillis();
        if(lastFrameMs != 0) {
            frameTimes.add((int) (now - lastFrameMs));
        }
        lastFrameMs = now;

        double fps = 1000.0/frameTimes.mean();

        ctx.setFont(Font.font("monospace", 10));
        ctx.setFill(textColor);
        ctx.setTextAlign(TextAlignment.RIGHT);
        ctx.setTextBaseline(VPos.TOP);
        ctx.fillText(String.format("%.1f FPS", fps), canvas.getWidth(), 0);
    }
    enforceFPSLimit();
}
项目:marlin-fx    文件:NGCanvas.java   
private void initAttributes() {
    globalAlpha = 1.0f;
    blendmode = Mode.SRC_OVER;
    fillPaint = Color.BLACK;
    strokePaint = Color.BLACK;
    linewidth = 1.0f;
    linecap = BasicStroke.CAP_SQUARE;
    linejoin = BasicStroke.JOIN_MITER;
    miterlimit = 10f;
    dashes = null;
    dashOffset = 0.0f;
    stroke = null;
    path.setWindingRule(Path2D.WIND_NON_ZERO);
    // ngtext stores no state between render operations
    // textLayout stores no state between render operations
    pgfont = (PGFont) Font.getDefault().impl_getNativeFont();
    smoothing = SMOOTH_GRAY;
    align = ALIGN_LEFT;
    baseline = VPos.BASELINE.ordinal();
    transform.setToScale(highestPixelScale, highestPixelScale);
    clipStack.clear();
    resetClip(false);
}
项目:openjfx-8u-dev-tests    文件:SeparatorApp.java   
@Override
public Node drawNode() {
    HBox root = new HBox();
    root.setSpacing(spacing);
    for (VPos pos : VPos.values()) {
        Separator separator = getSeparator();
        separator.setValignment(pos);
        if (separator.getValignment() != pos) {
            reportGetterFailure("separator.setHalignment()");
        }
        VBox box = new VBox();
        box.getChildren().addAll(new Label("[" + pos.name() + "]"), separator);
        root.getChildren().add(box);
    }
    return root;
}
项目:fictional-spoon    文件:CombatScreen.java   
/**
 * render the info label above the progress bar
 */
private void renderInfo() {
    // initialize render screen
    final GraphicsContext gc = gcs.get("info");
    gc.clearRect(0, 0, gc.getCanvas().getWidth(), gc.getCanvas().getHeight());

    // font settings
    gc.setFont(Global.DEFAULT_FONT);
    gc.setTextAlign(TextAlignment.CENTER);
    gc.setTextBaseline(VPos.BASELINE);

    // print out current success
    gc.setFill(Global.ORANGE);
    // gc.setLineWidth(1);

    gc.fillText(info, Global.WINDOW_WIDTH / 2, 50);

    // gc.strokeText(pointsText, 360, Window.SIZE_Y * 0.3);

}
项目:openjfx-8u-dev-tests    文件:Layout2App.java   
@Override
public Node drawNode() {
    pane = baseFill(new FlowPane());
    pane.setHgap(10);
    if (pane.getHgap() != 10) {
        reportGetterFailure("FlowPane.getHgap()");
    }

    pane.setColumnHalignment(HPos.LEFT);
    pane.setRowValignment(VPos.TOP);
    pane.setAlignment(Pos.BOTTOM_LEFT);//.setVpos(VPos.BOTTOM);
    if (pane.getAlignment() != Pos.BOTTOM_LEFT) {
        reportGetterFailure("FlowPane.getAlignment()");
    }

    return pane;
}