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

项目:PSE    文件:ItemViewAdapter.java   
/**
 * Creates the title and description text.
 * @return Returns a VBox containing the data.
 */
public VBox createText(){

    final VBox layout = new VBox(15.0f);
    layout.setAlignment(Pos.CENTER_LEFT);
    layout.setPadding(new Insets(10,10,10,10));
    layout.setMaxWidth(300.0f);

    lblTitle = new Label(this.title);
    lblTitle.setTextFill(javafx.scene.paint.Paint.valueOf("#ff0000"));
    lblTitle.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) );

    txtDescription = new Text(this.description);
    txtDescription.setFill(Paint.valueOf("#ffffff"));
    txtDescription.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.BOLD,12.0f) );
    txtDescription.setBoundsType(TextBoundsType.LOGICAL_VERTICAL_CENTER);

    layout.getChildren().add(lblTitle);
    layout.getChildren().add(txtDescription);

    return layout;

}
项目:FEFEditor    文件:Utils.java   
public static double computeTextHeight(Font font, String text, double wrappingWidth, double lineSpacing, TextBoundsType boundsType) {
    layout.setContent(text != null ? text : "", font.impl_getNativeFont());
    layout.setWrapWidth((float)wrappingWidth);
    layout.setLineSpacing((float)lineSpacing);
    if (boundsType == TextBoundsType.LOGICAL_VERTICAL_CENTER) {
        layout.setBoundsType(TextLayout.BOUNDS_CENTER);
    } else {
        layout.setBoundsType(0);
    }
    return layout.getBounds().getHeight();
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureName(String string) {
    Font font = new Font(9);
    name.setText(string);
    name.setBoundsType(TextBoundsType.VISUAL);
    name.setLayoutX(-name.getBoundsInLocal().getWidth() / 2 + 4.8);
    name.setLayoutY(radius * 1 / 2 + 4);
    name.setFill(FILL_COLOR);
    name.setFont(font);
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureName(String string) {
    Font font = new Font(9);
    name.setText(string);
    name.setBoundsType(TextBoundsType.VISUAL);
    name.setLayoutX(-name.getBoundsInLocal().getWidth() / 2 + 4.8);
    name.setLayoutY(radius * 1 / 2 + 4);
    name.setFill(FILL_COLOR);
    name.setFont(font);
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureName(String string) {
    Font font = new Font(9);
    name.setText(string);
    name.setBoundsType(TextBoundsType.VISUAL);
    name.setLayoutX(-name.getBoundsInLocal().getWidth() / 2 + 4.8);
    name.setLayoutY(radius * 1 / 2 + 4);
    name.setFill(FILL_COLOR);
    name.setFont(font);
}
项目:3DSFE-Randomizer    文件:Utils.java   
static double computeTextHeight(Font font, String text, double lineSpacing, TextBoundsType boundsType) {
    layout.setContent(text != null ? text : "", font.impl_getNativeFont());
    layout.setWrapWidth(0.0f);
    layout.setLineSpacing((float)lineSpacing);
    if (boundsType == TextBoundsType.LOGICAL_VERTICAL_CENTER) {
        layout.setBoundsType(TextLayout.BOUNDS_CENTER);
    } else {
        layout.setBoundsType(0);
    }
    return layout.getBounds().getHeight();
}
项目:board-client    文件:Checkers.java   
public Node createPiece(int piece, int column, int row) {
    StackPane pane = new StackPane();
    Rectangle background = new Rectangle(0, 0, 60, 60);
    background.setFill(((column + row) % 2) == 0 ? Color.WHITE : Color.GRAY);
    pane.getChildren().add(background);

    if (piece >=0 && piece < 8) {
        Circle circle = new Circle(30, 30, 25);
        if (piece / 4 == 1) {
            circle.setStrokeWidth(3);
        } else {
            circle.setStrokeWidth(0);
        }

        if ((piece % 4) / 2 == 0) {
            circle.setFill(Color.WHITE);
            circle.setStroke(Color.BLACK);
        } else {
            circle.setFill(Color.BLACK);
            circle.setStroke(Color.WHITE);
        }

        pane.getChildren().add(circle);

        if ((piece % 4) % 2 == 1) {
            Text text = new Text("♔");
            text.setFont(new Font(32));
            text.setFill(((piece % 4) / 2 == 0) ? Color.BLACK : Color.WHITE);
            text.setBoundsType(TextBoundsType.VISUAL);
            pane.getChildren().add(text);
        }
    }

    return pane;
}
项目:Breadth-First-Search    文件:GraphDrawer.java   
/**
 * Ritorna il crea il componente grafico testo utilizzando la stringa passata come parametro
 * @param s testo da visualizzare
 * @return testo creato come componente grafico.
 */
private Text createText(String s) {
    Text t = new Text();

    t.setText(s);
    t.setFont(new Font(16));
    t.setBoundsType(TextBoundsType.VISUAL);
    t.setStroke(Color.BLACK);
    this.centerText(t);

    return t;
}
项目:Kramer    文件:Layout.java   
protected static double getLineHeight(Font font,
                                      TextBoundsType boundsType) {
    Text text = new Text("WgTy\n ");
    text.setFont(font);
    Bounds tb = text.getBoundsInLocal();
    return Shape.intersect(text,
                           new Rectangle(tb.getMinX(), tb.getMinY(),
                                         tb.getWidth(), tb.getHeight()))
                .getBoundsInLocal()
                .getHeight();
}
项目:kotlinfx-ensemble    文件:StopWatchSample.java   
private void configureName(String string) {
    Font font = new Font(9);
    name.setText(string);
    name.setBoundsType(TextBoundsType.VISUAL);
    name.setLayoutX(-name.getBoundsInLocal().getWidth() / 2 + 4.8);
    name.setLayoutY(radius * 1 / 2 + 4);
    name.setFill(FILL_COLOR);
    name.setFont(font);
}
项目:SunburstJ    文件:SunburstViewSkin.java   
public SunburstCenter(){

            // Most inner circle which on click triggers the zoom out navigation.
            centerCircle = new Circle();
            centerCircle.setFill(Color.ORANGE);
            // Set id in order to apply CSS styles.
            centerCircle.setId("centerCircle");
            centerCircle.setOnMouseClicked(event -> onAction());

            description = new Text("<Root>");
            description.setBoundsType(TextBoundsType.VISUAL);

            this.getChildren().addAll(centerCircle, description);
        }
项目:HotaruFX    文件:TextNode.java   
public PropertyTimeline<String> boundsTypeProperty() {
    return boundsType.setIfEmptyThenGet(enumToString(TextBoundsType.class, text.boundsTypeProperty()));
}
项目:Kramer    文件:Layout.java   
public static LabelStyle labelStyle(Label label) {
    return new LabelStyle(add(label.getInsets(), label.getPadding()),
                          getLineHeight(label.getFont(),
                                        TextBoundsType.LOGICAL_VERTICAL_CENTER),
                          label.getFont());
}
项目:particlesfx    文件:Attractor.java   
/**
 * Circle with a label
 */
@Override
public Node createView() {

    Group group = new Group();

    double radius = width / 2;

    Circle circle = new Circle(radius);

    circle.setCenterX(radius);
    circle.setCenterY(radius);

    circle.setStroke(Color.RED);
    circle.setFill(Color.RED.deriveColor(1, 1, 1, 0.3));

    group.getChildren().add( circle);

    Text text = new Text("Attractor");
    text.setStroke(Color.RED);
    text.setFill(Color.RED);
    text.setBoundsType(TextBoundsType.VISUAL);

    text.relocate(radius - text.getLayoutBounds().getWidth() / 2, radius - text.getLayoutBounds().getHeight() / 2);

    group.getChildren().add( text);

    return group;
}
项目:particlesfx    文件:Repeller.java   
/**
 * Circle with a label
 */
@Override
public Node createView() {

    Group group = new Group();

    double radius = width / 2;

    Circle circle = new Circle(radius);

    circle.setCenterX(radius);
    circle.setCenterY(radius);

    circle.setStroke(Color.YELLOW);
    circle.setFill(Color.YELLOW.deriveColor(1, 1, 1, 0.3));

    group.getChildren().add( circle);

    Text text = new Text("Repeller");
    text.setStroke(Color.YELLOW);
    text.setFill(Color.YELLOW);
    text.setBoundsType(TextBoundsType.VISUAL);

    text.relocate(radius - text.getLayoutBounds().getWidth() / 2, radius - text.getLayoutBounds().getHeight() / 2);

    group.getChildren().add( text);

    return group;
}
项目:JavaOne2015JavaFXPitfalls    文件:Attractor.java   
/**
 * Circle with a label
 */
@Override
public Node createView() {

    Group group = new Group();

    double radius = width / 2;

    Circle circle = new Circle( radius);

    circle.setCenterX(radius);
    circle.setCenterY(radius);

    circle.setStroke(Color.RED);
    circle.setFill(Color.RED.deriveColor(1, 1, 1, 0.3));

    group.getChildren().add( circle);

    Text text = new Text( "Attractor\n(Direction)");
    text.setStroke(Color.RED);
    text.setFill(Color.RED);
    text.setBoundsType(TextBoundsType.VISUAL);

    text.relocate(radius - text.getLayoutBounds().getWidth() / 2, radius - text.getLayoutBounds().getHeight() / 2);

    group.getChildren().add( text);

    return group;
}
项目:JavaOne2015JavaFXPitfalls    文件:Repeller.java   
/**
 * Circle with a label
 */
@Override
public Node createView() {

    Group group = new Group();

    double radius = width / 2;

    Circle circle = new Circle( radius);

    circle.setCenterX(radius);
    circle.setCenterY(radius);

    circle.setStroke(Color.YELLOW);
    circle.setFill(Color.YELLOW.deriveColor(1, 1, 1, 0.3));

    group.getChildren().add( circle);

    Text text = new Text( "Repeller");
    text.setStroke(Color.YELLOW);
    text.setFill(Color.YELLOW);
    text.setBoundsType(TextBoundsType.VISUAL);

    text.relocate(radius - text.getLayoutBounds().getWidth() / 2, radius - text.getLayoutBounds().getHeight() / 2);

    group.getChildren().add( text);

    return group;
}