本文整理汇总了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;
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例9: boundsTypeProperty
import javafx.scene.text.TextBoundsType; //导入依赖的package包/类
public PropertyTimeline<String> boundsTypeProperty() {
return boundsType.setIfEmptyThenGet(enumToString(TextBoundsType.class, text.boundsTypeProperty()));
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}