当前位置: 首页>>代码示例>>Java>>正文


Java TextBoundsType类代码示例

本文整理汇总了Java中javafx.scene.text.TextBoundsType的典型用法代码示例。如果您正苦于以下问题:Java TextBoundsType类的具体用法?Java TextBoundsType怎么用?Java TextBoundsType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextBoundsType类属于javafx.scene.text包,在下文中一共展示了TextBoundsType类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createText

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
/**
 * 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;

}
 
开发者ID:Theldus,项目名称:PSE,代码行数:27,代码来源:ItemViewAdapter.java

示例2: computeTextHeight

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
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();
}
 
开发者ID:thane98,项目名称:FEFEditor,代码行数:12,代码来源:Utils.java

示例3: configureName

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:StopWatch.java

示例4: computeTextHeight

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
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();
}
 
开发者ID:thane98,项目名称:3DSFE-Randomizer,代码行数:12,代码来源:Utils.java

示例5: createPiece

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
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;
}
 
开发者ID:edwardxia,项目名称:board-client,代码行数:36,代码来源:Checkers.java

示例6: createText

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:steppp,项目名称:Breadth-First-Search,代码行数:17,代码来源:GraphDrawer.java

示例7: getLineHeight

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
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();
}
 
开发者ID:ChiralBehaviors,项目名称:Kramer,代码行数:12,代码来源:Layout.java

示例8: SunburstCenter

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
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);
        }
 
开发者ID:IsNull,项目名称:SunburstJ,代码行数:15,代码来源:SunburstViewSkin.java

示例9: boundsTypeProperty

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
public PropertyTimeline<String> boundsTypeProperty() {
    return boundsType.setIfEmptyThenGet(enumToString(TextBoundsType.class, text.boundsTypeProperty()));
}
 
开发者ID:aNNiMON,项目名称:HotaruFX,代码行数:4,代码来源:TextNode.java

示例10: labelStyle

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
public static LabelStyle labelStyle(Label label) {
    return new LabelStyle(add(label.getInsets(), label.getPadding()),
                          getLineHeight(label.getFont(),
                                        TextBoundsType.LOGICAL_VERTICAL_CENTER),
                          label.getFont());
}
 
开发者ID:ChiralBehaviors,项目名称:Kramer,代码行数:7,代码来源:Layout.java

示例11: createView

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:HanSolo,项目名称:particlesfx,代码行数:32,代码来源:Attractor.java

示例12: createView

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:HanSolo,项目名称:particlesfx,代码行数:32,代码来源:Repeller.java

示例13: createView

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:amoAHCP,项目名称:JavaOne2015JavaFXPitfalls,代码行数:32,代码来源:Attractor.java

示例14: createView

import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:amoAHCP,项目名称:JavaOne2015JavaFXPitfalls,代码行数:32,代码来源:Repeller.java


注:本文中的javafx.scene.text.TextBoundsType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。