Java 类javafx.scene.text.TextAlignment 实例源码

项目: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    文件: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);
    }
}
项目:CNU_TermProject_SoftwareEngineering    文件:ShoppingBasketController.java   
public void settingTab(Tab tab, String CategoryName) {
    AnchorPane content = (AnchorPane) tab.getContent();
    ArrayList singleList = getItemListByCategory(CategoryName);
    for (int i = 0; i < singleList.size(); i++) {
        DAOItem temp = (DAOItem) singleList.get(i);
        int indexX = i % 4;
        int indexY = i / 4;
        Button button = new Button();
        button.setPrefWidth(buttonSize);
        button.setPrefHeight(buttonSize);
        button.setLayoutX(startX + indexX * gap + (buttonSize * indexX));
        button.setLayoutY(startY + indexY * gap + (buttonSize * indexY));
        button.setText(temp.getItemName() + "\n" + "(" + temp.getItemPrice() + ")");
        button.setTextAlignment(TextAlignment.CENTER);
        button.setOnAction(this::menuItemAction);
        button.setWrapText(true);
        button.setId(temp.getItemName());
        content.getChildren().add(button);
    }
}
项目:WebPLP    文件:LEDDisplay.java   
private LED createLED(int number)
{
    String labelText = Integer.toString(number);
    Label ledLabel = new Label(labelText);
    ledLabel.setFont(new Font(FONT_NAME, FONT_SIZE));
    ledLabel.setTextAlignment(TextAlignment.CENTER);
    ledLabel.setTextFill(FONT_COLOR);

    LED led = new LED();
    led.setMinHeight(DEFAULT_SIZE);
    led.setPrefWidth(DEFAULT_SIZE);
    led.setCenter(ledLabel);
    updateLEDStyle(led);

    return led;
}
项目:WebPLP    文件:SwitchesDisplay.java   
private Switch createSwitch(int index)
{
    Switch button = new Switch();
    button.setFont(new Font(FONT_NAME, FONT_SIZE));
    button.setTextAlignment(TextAlignment.CENTER);
    button.setTextFill(FONT_COLOR);
    button.setPrefHeight(DEFAULT_SIZE);
    button.setPrefWidth(DEFAULT_SIZE);

    String labelText = Integer.toString(index);
    button.setText(labelText);
    updateSwitchStyle(button);

    button.setOnAction((event) -> toggle(button));

    return button;
}
项目:voogasalad-ltub    文件:GameStatsView.java   
private void makeStatsPane(Map<String, String> stats) {
    myStats = new VBox(5);
    for(String statName : stats.keySet()){
        Text nameAndValue = new Text(statName + ": " + stats.get(statName));

        //TODO: set text size 
        TextFlow wrapper = new TextFlow(nameAndValue);
        wrapper.setTextAlignment(TextAlignment.LEFT);
        wrapper.getStylesheets().add("resources/socialStyle.css");
        wrapper.getStyleClass().add("textfill");
        myStats.getChildren().add(wrapper);
    }
    myStats.getStylesheets().add("resources/socialStyle.css");
    myStats.getStyleClass().add("statsbox");

}
项目:stvs    文件:IndexTableCell.java   
/**
 * IndexTableCell
 * @param tableView the table the index-cell should be attached to. This value is required for
 *                  displaying the comment icon.
 */
public IndexTableCell(TableView tableView) {
  super();
  this.tableView = tableView;
  ChangeListener<Number> indexChangeListener = (observableValue, oldIndex, newIndexNumber) -> {
    int newIndex = newIndexNumber.intValue();
    if (newIndex < 0) {
      return;
    }
    icon.visibleProperty().bind(getCommentPropertyByIndex(newIndex).isEmpty().not());
    tooltip.textProperty().bind(getCommentPropertyByIndex(newIndex));
  };
  indexChangeListener.changed(null, 0, this.getIndex());
  this.indexProperty().addListener(indexChangeListener);

  this.setGraphic(icon);
  this.setTextAlignment(TextAlignment.RIGHT);
  this.setTooltip(tooltip);
}
项目: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    文件: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 redraw() {
    ctx.clearRect(0, 0, width, height);
    paths.forEach((path, plotItem) -> path.draw(ctx, true, true));
    Color             textColor      = getTextColor();
    int               noOfCategories = chartItems.size();
    DateTimeFormatter formatter      = getCategory().formatter();

    for (int category = 0 ; category < noOfCategories ; category++) {
        List<ChartItemData> itemDataInCategory = itemsPerCategory.get(category);

        // Go through all item data of the current category
        for (ChartItemData itemData : itemDataInCategory) {
            ChartItem item      = itemData.getChartItem();
            CtxBounds bounds    = itemData.getBounds();
            Color     itemColor = item.getFill();

            // Draw item boxes with their labels
            ctx.setFill(itemColor);
            ctx.fillRect(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
            ctx.setLineWidth(0);
            ctx.setStroke(itemColor);
            ctx.strokeRect(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());

            if (item.getValue() > 1) {
                ctx.setFill(textColor);
                ctx.setTextAlign(category == noOfCategories ? TextAlignment.RIGHT : TextAlignment.LEFT);
                ctx.fillText(item.getName(), itemData.getTextPoint().getX(), itemData.getTextPoint().getY(), bounds.getWidth());
            }
        }
        // Draw category text
        ChartItemData firstItem = itemDataInCategory.get(0);
        ctx.fillText(formatter.format(firstItem.getLocalDate()), firstItem.getTextPoint().getX(), reducedHeight + size * 0.02, firstItem.bounds.getWidth());
    }
}
项目:helloiot    文件:TopicInfoEdit.java   
@Override
public Node getGraphic() {

    Text t = new Text();
    t.setFill(Color.WHITE);
    t.setFont(Font.font(ExternalFonts.ROBOTOBOLD, FontWeight.BOLD, 10.0));
    TextFlow tf = new TextFlow(t);
    tf.setPrefWidth(55);
    tf.setTextAlignment(TextAlignment.CENTER);
    tf.setPadding(new Insets(2, 5, 2, 5));

    if ("Subscription".equals(getType())) {
        t.setText("SUB");
        tf.setStyle("-fx-background-color: #001A80; -fx-background-radius: 12px;");
    } else if ("Publication".equals(getType())) {
        t.setText("PUB");
        tf.setStyle("-fx-background-color: #4D001A; -fx-background-radius: 12px;");
    } else { // "Publication/Subscription"
        t.setText("P/SUB");
        tf.setStyle("-fx-background-color: #003300; -fx-background-radius: 12px;");
    }
    return tf;
}
项目:coaster    文件:ToasterScreen.java   
public void render(long ms, boolean renderBackGround) {
    gc.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
    //Match debug
    //Styling
    int rightEdge = viewport.getResWidth();
    int fontSize = 20; //bigger than debug cause we better fam; plus we all know size matters
    Color fontCol = Color.WHITE;
    Color shadowCol = Color.BLACK;

    gc.setFont(new Font(fontSize));
    canvas.setStyle("-fx-stroke: black;-fx-stroke-width: 2px;");

    gc.setTextAlign(TextAlignment.RIGHT);
    String text = Toaster.getToast(new Date());

    gc.setFill(shadowCol);
    gc.fillText(text, rightEdge - 20 + 1, canvas.getHeight() / 2 + 1);
    gc.setFill(fontCol);
    gc.fillText(text, rightEdge - 20, canvas.getHeight() / 2);


}
项目:tilesfx    文件:DateTileSkin.java   
@Override protected void initGraphics() {
    super.initGraphics();

    final ZonedDateTime TIME = tile.getTime();

    titleText = new Text(DAY_FORMATTER.format(TIME));
    titleText.setFill(tile.getTitleColor());

    description = new Label(Integer.toString(TIME.getDayOfMonth()));
    description.setAlignment(Pos.CENTER);
    description.setTextAlignment(TextAlignment.CENTER);
    description.setWrapText(true);
    description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
    description.setTextFill(tile.getTextColor());
    description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.72);
    description.setFont(Fonts.latoLight(PREFERRED_HEIGHT * 0.65));

    text = new Text(MONTH_YEAR_FORMATTER.format(TIME));
    text.setFill(tile.getTextColor());

    getPane().getChildren().addAll(titleText, text, description);
}
项目:tilesfx    文件:TextTileSkin.java   
@Override protected void initGraphics() {
    super.initGraphics();

    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());

    description = new Label(tile.getDescription());
    description.setAlignment(tile.getDescriptionAlignment());
    description.setTextAlignment(TextAlignment.RIGHT);
    description.setWrapText(true);
    description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
    description.setTextFill(tile.getTextColor());
    description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795);
    Helper.enableNode(description, tile.isTextVisible());

    text = new Text(tile.getText());
    text.setFill(tile.getUnitColor());
    Helper.enableNode(text, tile.isTextVisible());

    getPane().getChildren().addAll(titleText, text, description);
}
项目:fictional-spoon    文件:AlertDecorator.java   
@Override
public void render() {
    super.render();

    // clear screen
    GraphicsContext gc = gcs.get("alert");
    gc.clearRect(0, 0, gcs.get("alert").getCanvas().getWidth(), gcs.get("alert").getCanvas().getHeight());

    // dont render if the alert should not be viewed
    if (remainingTicks <= 0) {
        return;
    }

    // font settings to be set
    gc.setFont(Global.BIG_FONT);
    gc.setTextAlign(TextAlignment.CENTER);
    gc.setTextBaseline(VPos.CENTER);
    gc.setLineWidth(1);

    // render text with alpha opcity
    gc.setFill(Color.RED.deriveColor(0, 1.2, 1, alpha));
    gc.fillText(alert, gcs.get("alert").getCanvas().getWidth() / 2, 50);
}
项目: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);

}
项目:IIITB-LMS-Client-OLD    文件:forumCard.java   
public forumCard(Forum forum){
    this.card_forum = forum;
    ArrayList<Forum> list_of_forums = new ArrayList<Forum>(); 
    String fullPath = String.format("%s", System.getProperty("user.dir"));
    super.init(1000, 550, forum.get_title(), "file:" + fullPath + "/" +   forum.get_icon_path() );

    super.add_to_class("forum_card");
    super.add_class_to_label("forum_card_label");
    super.add_class_to_image("forum_card_image");
    super.set_image_dim(60,60);
    super.set_image_alignment(Pos.TOP_LEFT);
    super.set_label_alignment(Pos.TOP_CENTER);

    StackPane displayPane = new StackPane();
    displayPane.setPrefSize(800, 300);
    displayPane.getStyleClass().addAll( "forum_display" );
    Label text = new Label(forum.get_body());
    text.setWrapText(true);
    text.setTextAlignment(TextAlignment.JUSTIFY);
    text.getStyleClass().addAll( "forum_display_text" );
    StackPane.setAlignment(text,Pos.CENTER);
    displayPane.getChildren().addAll(text);
    super.getChildren().addAll(displayPane);

}
项目:travelimg    文件:SlideDivider.java   
public SlideDivider() {
    getStyleClass().add("divider");

    setOnDragEntered(this::handleDragEntered);
    setOnDragOver(this::handleDragOver);
    setOnDragDropped(this::handleDragDropped);
    setOnDragExited(this::handleDragExited);

    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);

    icon.setGlyphName("PLUS");
    icon.setTextAlignment(TextAlignment.CENTER);
    HBox.setHgrow(icon, Priority.ALWAYS);
    setGraphic(icon);

    setOnAction((event) -> {
        if (slideAddedCallback != null) {
            slideAddedCallback.run();
        }
    });
}
项目:pattypan    文件:LoginPane.java   
private void setContent() {
  TextFlow flow = new TextFlow(new Text(Util.text("login-intro")), link);
  flow.setTextAlignment(TextAlignment.CENTER);
  addElement(flow);

  addElement(loginText);
  addElement(passwordText);
  addElement(loginButton);
  addElement(loginStatus);

  if (!Settings.getSetting("user").isEmpty()) {
    loginText.setText(Settings.getSetting("user"));
    Platform.runLater(() -> {
      passwordText.requestFocus();
    });
  }
}
项目:pattypan    文件:CreateFilePane.java   
private void showOpenFileButton() {
  Hyperlink link = new Hyperlink(Util.text("create-file-open"));
  TextFlow flow = new TextFlow(new WikiLabel("create-file-success"), link);
  flow.setTextAlignment(TextAlignment.CENTER);
  addElement(flow);
  link.setOnAction(ev -> {
    try {
      Desktop.getDesktop().open(Session.FILE);
    } catch (IOException ex) {
      LOGGER.log(Level.WARNING, 
          "Cannot open file: {0}",
          new String[]{ex.getLocalizedMessage()}
      );
    }
  });

  nextButton.linkTo("StartPane", stage, true).setText(Util.text("create-file-back-to-start"));
  nextButton.setVisible(true);
}
项目: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();
}
项目:jfxgauge    文件:ThermometerSkin.java   
private void drawMarking(double value, HorizontalDirection side, double markWidth, String... styles) {
    double y = getValueHeight(value);
    double x = (side == HorizontalDirection.LEFT) ? (bottomRadius - topRadius - markWidth) : (bottomRadius + topRadius);
    Line line = new Line(x, y, x + markWidth, y);
    line.getStyleClass().setAll(Arrays.stream(styles).map(style -> style + "-marking").collect(Collectors.toList()));
    pane.getChildren().add(line);
    markings.add(line);

    Text text = new Text(gauge.getFormattedValue(value));
    text.setY(y + 4);
    text.getStyleClass().setAll(Arrays.stream(styles).map(style -> style + "-text").collect(Collectors.toList()));
    if(side == HorizontalDirection.LEFT) {
        text.setTextAlignment(TextAlignment.RIGHT);
        double wrappingWidth = restrain(2 * bottomRadius, 60, 240);
        text.setWrappingWidth(wrappingWidth);
        text.setX(x - wrappingWidth - 4);
    } else {
        text.setTextAlignment(TextAlignment.LEFT);
        text.setX(x + markWidth + 4);
    }
    pane.getChildren().add(text);
    markings.add(text);
}
项目:openjfx-8u-dev-tests    文件:LabeledsAbstactApp.java   
protected void addAlignment(List<Change<Labeled>> list, final boolean wrapped, final String text, String mark) {
    for (final TextAlignment alignment : TextAlignment.values()) {
        list.add(new Change<Labeled>(alignment.toString() + (wrapped ? "_wrapped" : "") + mark) {
            public void apply(Labeled labeled) {
                labeled.setText("TextAlignment = " + alignment.toString() + text);
                labeled.setWrapText(wrapped);
                Utils.LayoutSize layout = new Utils.LayoutSize(250, 40, 250, 40, 250, 40);
                layout.apply(labeled);
                labeled.setTextAlignment(alignment);
                if (labeled.getTextAlignment() != alignment) {
                    reportGetterFailure(getMarker());
                }
            }
        });
    }
}
项目:openjfx-8u-dev-tests    文件:RichTextMixedTest.java   
/**
 * Test for alignment of differents nodes in TextFlow.
 */
@Test(timeout = 30000)
public void alignmentTest() {
    setFlowBorder(true);
    Pages[] list = new Pages[3];
    list[0] = Pages.TextPage;
    list[1] = Pages.RectanglePage;
    list[2] = Pages.ButtonPage;
    for (TextAlignment alig : TextAlignment.values()) {
        setFlowWidth(RichTextPropertiesApp.paneWidth);
        fillFlow(list, alig.name() + MULTILINE_TEXT);
        setAlignment(alig);
        addFlow();
    }
    check("alignmentTest");
}
项目:NetChess    文件:MainWindowController.java   
private void paintPlayerInfo(final ChessPlayer player, final Image img, final double imgX,
                             final double textX) {
    // Рисуем фигуру короля
    gameGC.drawImage(img,
            imgX,
            PLAYER_IMAGE_FIRSTLINE_Y);

    // Рисуем информацию об игроке
    gameGC.fillText(player.getName(),
            textX,
            PLAYER_IMAGE_FIRSTLINE_Y);
    gameGC.fillText(Integer.toString(player.getRank()),
            textX,
            PLAYER_IMAGE_FIRSTLINE_Y + GAME_INFO_DELTA_Y);

    // Если игра закончилась - выводим начисленные очки
    gameGC.setTextAlign(TextAlignment.CENTER);
    if (game.isFinished()) {
        String scores = player.getAccruedScores() < 0 ?
                Integer.toString(player.getAccruedScores()) :
                "+" + Integer.toString(player.getAccruedScores());
        gameGC.fillText(scores,
                imgX + FIGURE_IMG_SIZE / 2,
                PLAYER_IMAGE_FIRSTLINE_Y + FIGURE_IMG_SIZE + PLAYER_SCORES_OFFSET_Y);
    }
}
项目:fictional-spoon    文件:HelpScreen.java   
@Override
public void render() {
    // start from clean screen
    GraphicsContext gc = gcs.get("main");
    gc.clearRect(0, 0, gc.getCanvas().getWidth(), gc.getCanvas().getHeight());

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

    // text
    gc.setFill(Global.RED);
    gc.setStroke(Global.RED);

    gc.fillText(text[index], Global.WINDOW_WIDTH / 2, Global.WINDOW_HEIGHT * 0.4);
    // gc.strokeLine(0, 75 + 20, Window.SIZE_X, 75 + 20);

    // gc.setFont(Window.DEFAULT_FONT);
    // for (int i = 0; i < text.length; i++) {
    // gc.fillText(text[i], Window.SIZE_X / 2, 200 + i * 100);
    // }
}
项目:NetChess    文件:MainWindowController.java   
private void paintNumeration() {
    // Выравнивание текста
    gameGC.setTextAlign(TextAlignment.CENTER);
    gameGC.setTextBaseline(VPos.CENTER);

    gameGC.setFont(NUMERATION_FONT);
    gameGC.setFill(Color.BLACK);

    for (int j = CELL_MIN; j < CELL_COUNT; j++) {
        // Вертикальные цифры
        gameGC.fillText(
                Integer.toString(CELL_COUNT - j),
                CHESSBOARD_X - NUMERATIONS_OFFSET,
                CHESSBOARD_Y + j * CELL_SIZE + CELL_SIZE / 2);
        // Горизонтальные цифры
        gameGC.fillText(
                NUMERATION_STR_HORIZONTAL[j],
                CHESSBOARD_X + j * CELL_SIZE + CELL_SIZE / 2,
                CHESSBOARD_Y + CHESSBOARD_H + NUMERATIONS_OFFSET);
    }
}
项目:qupath    文件:TMAScoreImportCommand.java   
@Override
public void updateItem(TMACoreObject item, boolean empty) {
    super.updateItem(item, empty);
    setWidth(150);
    setHeight(150);
    setMaxWidth(200);
    setMaxHeight(200);
    if (item == null || empty) {
        setText(null);
        setGraphic(null);
        setTooltip(null);
        return;
    }
    if (item.isMissing())
        setTextFill(ColorToolsFX.getCachedColor(PathPrefs.getTMACoreMissingColor()));
    else
        setTextFill(ColorToolsFX.getCachedColor(PathPrefs.getTMACoreColor()));

    setAlignment(Pos.CENTER);
    setTextAlignment(TextAlignment.CENTER);
    setContentDisplay(ContentDisplay.CENTER);
    setText(getDisplayString(item));
    tooltip.setText(getExtendedDescription(item));
    setTooltip(tooltip);
}
项目: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);
}
项目:incubator-netbeans    文件:StopWatch.java   
private Text createNumber(String number, double layoutX, double layoutY) {
    Text text = new Text(number);
    text.setLayoutX(layoutX);
    text.setLayoutY(layoutY);
    text.setTextAlignment(TextAlignment.CENTER);
    text.setFill(FILL_COLOR);
    text.setFont(NUMBER_FONT);
    return text;
}
项目:marathonv5    文件:StopWatchSample.java   
private Text createNumber(String number, double layoutX, double layoutY) {
    Text text = new Text(number);
    text.setLayoutX(layoutX);
    text.setLayoutY(layoutY);
    text.setTextAlignment(TextAlignment.CENTER);
    text.setFill(FILL_COLOR);
    text.setFont(NUMBER_FONT);
    return text;
}
项目:marathonv5    文件:CheckListFormNode.java   
private Node addSeparator(String name) {
    Separator separator = new Separator();
    separator.setPadding(new Insets(8, 0, 0, 0));
    HBox.setHgrow(separator, Priority.ALWAYS);
    Text text = new Text(name);
    text.setTextAlignment(TextAlignment.CENTER);
    HBox hBox = new HBox(text, separator);
    HBox.setHgrow(hBox, Priority.ALWAYS);
    return hBox;
}
项目:marathonv5    文件:StopWatchSample.java   
private Text createNumber(String number, double layoutX, double layoutY) {
    Text text = new Text(number);
    text.setLayoutX(layoutX);
    text.setLayoutY(layoutY);
    text.setTextAlignment(TextAlignment.CENTER);
    text.setFill(FILL_COLOR);
    text.setFont(NUMBER_FONT);
    return text;
}
项目:testing-video    文件:BlackLevelBase.java   
private static Label text(Resolution res, YCbCr matrix, int col) {
    Label l = new Label(Integer.toString(getLuma(matrix, col)));
    l.setFont(font(res.height / 54));
    l.setTextFill(gray(matrix.fromLumaCode(matrix.YMIN * 4)));
    l.setTextAlignment(TextAlignment.CENTER);
    l.setAlignment(Pos.CENTER);
    l.setPrefSize(getW(res.width, col), getLabelH(res.height));
    return l;
}
项目:dynamo    文件:AlarmSkin.java   
private void update(){
    nameText.setVisible(getSkinnable().getCurrentValue());
    nameText.setText(getSkinnable().getName().toUpperCase());
    nameText.setFont(Font.font(width * 0.07));

    background.setStyle(getSkinnable().getCurrentValue() ? "-background-color:".concat(WARNING_COLOR).concat(";") : "-background-color:".concat(NORMAL_COLOR).concat(";"));

    nameText.setTextAlignment(TextAlignment.CENTER);
    nameText.setX((width - nameText.getLayoutBounds().getWidth()) * 0.5);
    nameText.setY((height - nameText.getLayoutBounds().getHeight()) * 0.5);
    nameText.setTextOrigin(VPos.TOP);

    frame.setVisible(getSkinnable().getCurrentValue());
}
项目:dynamo    文件:DisplaySkin.java   
protected void handleControlPropertyChanged(final String PROPERTY) {
    switch (PROPERTY){
        case "TEXT_FILL":
            titleText.setFill(getSkinnable().getTextFill());
            currentValueText.setFill(getSkinnable().getTextFill());
            unitText.setFill(getSkinnable().getTextFill());
            break;
        case "RESIZE":
            resize();
            updateDisplay();
            break;
        case "UPDATE_VALUE":
            updateDisplay();
            break;
        case "UPDATE_TITLE":
            titleText.setText(getSkinnable().getTitle());
            titleText.setX((width - titleText.getLayoutBounds().getWidth()) * 0.5);
            break;
        case "UPDATE_UNIT":
            unitText.setTextOrigin(VPos.BOTTOM);
            unitText.setTextAlignment(TextAlignment.RIGHT);
            unitText.setText(getSkinnable().getUnit());
            unitText.setX((width - unitText.getLayoutBounds().getWidth()) - height * 0.08);
            unitText.setY(height * 0.9);
            break;
        case "UNIT_VISIBLE":
            unitText.setOpacity(getSkinnable().getUnitVisible() ? 1 : 0);
            break;
        case "FONTS":
            updateFonts();
            break;
        case "ALARMED":
            warningIcon.setOpacity(getSkinnable().getAlarmed() ? 1 : 0);
            frame.setStyle(getSkinnable().getAlarmed() ? "-fx-background-color: -warning-color" : "-fx-background-color: -frame-color");
            break;
    }
}
项目:dynamo    文件:LevelBarSkin.java   
private void resize() {
    width   = getSkinnable().getWidth();
    height  = getSkinnable().getHeight();
    size    = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();

    if (width > 0 && height > 0) {
        main.setPrefSize(width, height);

        titleText.setFont(Font.font("Xolonium", width * TITLE_FONT_SIZE_FACTOR));
        titleText.setTextOrigin(VPos.TOP);
        titleText.setTextAlignment(TextAlignment.CENTER);
        titleText.setText(getSkinnable().getTitle());
        titleText.setX((width - titleText.getLayoutBounds().getWidth()) * 0.5);

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

        barWidth  = width * BAR_WIDTH_FACTOR;
        barHeight = (height - titleText.getLayoutBounds().getHeight()) * 0.95;

        unitText.setText(getSkinnable().getUnitVisible() ? getSkinnable().getUnit() : "");
        unitText.setFont(Fonts.xoloniumBold(size * UNIT_FONT_SIZE_FACTOR));
        unitText.setTextOrigin(VPos.BOTTOM);
        unitText.setTextAlignment(TextAlignment.RIGHT);
        unitText.setX(width - unitText.getLayoutBounds().getWidth());
        unitText.setY(titleText.getLayoutBounds().getHeight());

        sectionsCanvas.setWidth(width);
        sectionsCanvas.setHeight(barHeight);
        sectionsCanvas.setTranslateY(height - barHeight);
        sections.clearRect(0,0,sectionsCanvas.getWidth(),sectionsCanvas.getHeight());

        drawSections();
        updatePointer();
    }
}
项目:xpanderfx    文件:TileBackground.java   
public TileBackground() {
    super.setMinSize(140.6, 136.8);
    super.setMaxSize(140.6, 136.8);
    super.setTextAlignment(TextAlignment.CENTER);
    super.setStyle("-fx-base: grey; " +
        "-fx-background-color:linear-gradient(darkslategrey, transparent,darkslategrey);"+
        "-fx-background-radius: 8;" +
        "-fx-border-radius: 8;"
    );
}