本文整理汇总了Java中javafx.scene.text.Text.setY方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setY方法的具体用法?Java Text.setY怎么用?Java Text.setY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.text.Text
的用法示例。
在下文中一共展示了Text.setY方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addYTickLine
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void addYTickLine(String value, double x, double y, int index) {
Line line = new Line(x - 5, y, x + 5, y);
axisComponts.add(line);
Text text = new Text(value);
axisComponts.add(text);
if (index == 0) {
text.setX(x - 40);
} else {
text.setX(x + 15);
}
text.setY(y + 5);
getChildren().addAll(line, text);
}
示例2: createScene
import javafx.scene.text.Text; //导入方法依赖的package包/类
private static Scene createScene() {
Group root = new Group();
Scene scene = new Scene(root, javafx.scene.paint.Color.ALICEBLUE);
Text text = new Text();
text.setX(40);
text.setY(100);
text.setFont(new javafx.scene.text.Font(25));
text.setText("JavaFX Window!");
root.getChildren().add(text);
return (scene);
}
示例3: draw
import javafx.scene.text.Text; //导入方法依赖的package包/类
public void draw() {
// Draw elevator
Rectangle rgB = new Rectangle(WIDTH, HEIGHT);
rgB.setFill(Color.TRANSPARENT);
this.getChildren().add(rgB);
rgT = new Rectangle((WIDTH / 3) * 2 + (WIDTH / (WIDTH / 8)), HEIGHT / 1.5 + (HEIGHT / (HEIGHT / 4)));
rgT.setFill(Color.web("bfbfbf"));
rgT.setX(WIDTH / 2 - rgT.getWidth() / 2);
rgT.setY(HEIGHT - rgT.getHeight());
this.getChildren().add(rgT);
//Left side elevator shaft door
rgD1 = new Rectangle(WIDTH / 3, HEIGHT / 1.5);
rgD1.setFill(Color.web("a5a5a5"));
rgD1.setX(WIDTH / 2 - rgD1.getWidth());
rgD1.setY(HEIGHT - rgD1.getHeight());
this.getChildren().add(rgD1);
//Right side elevator shaft door
rgD2 = new Rectangle(WIDTH / 3, HEIGHT / 1.5);
rgD2.setFill(Color.web("a5a5a5"));
rgD2.setX(WIDTH / 2);
rgD2.setY(HEIGHT - rgD2.getHeight());
this.getChildren().add(rgD2);
// Draw text
tFloorNum = new Text(String.valueOf(FLOORNUM));
tFloorNum.setFill(Color.web("bfbfbf"));
tFloorNum.setFont(Font.font("Verdana", 20));
tFloorNum.setX(WIDTH / 2 - tFloorNum.getBoundsInParent().getWidth() / 2);
tFloorNum.setY(rgT.getY() - tFloorNum.getBoundsInParent().getHeight() / 2);
this.getChildren().add(tFloorNum);
}
示例4: displayVersion
import javafx.scene.text.Text; //导入方法依赖的package包/类
public void displayVersion(boolean display) {
if (display == true) { // Display
// Assign value
txtVersion = new Text("Version: " + GAME_VERSION);
// Label for display version
txtVersion.setFill(Color.rgb(234, 234, 234));
// Move txtVersion to bottom left of pane
txtVersion.setY(HEIGHT + 8);
getChildren().add(txtVersion); // Add txtVersion to pane
} else if (display == false) { // Do not display
getChildren().remove(txtVersion);
}
}
示例5: licencesp
import javafx.scene.text.Text; //导入方法依赖的package包/类
private ScrollPane licencesp(double width, double height) {
ScrollPane sp = new ScrollPane();
Text text = new Text();
text.setX(width * 0.1);
text.setY(height * 0.1);
text.setFont(new Font(20));
text.setFill(new Color(1, 1, 1, 1));
StringBuilder licence = new StringBuilder(10000);
String line;
try {
BufferedReader br = new BufferedReader(new FileReader("data/common/licence.txt"));
while ((line = br.readLine()) != null) {
licence.append('\n');
licence.append(line);
}
br.close();
} catch (IOException e) {
log.error("Exception", e);
}
text.setText(licence.toString());
sp.setContent(text);
sp.setFitToHeight(true);
sp.setFitToWidth(true);
sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
sp.setVmax(height);
// sp.setPrefSize(width*0.8, height*0.8);
return sp;
}
示例6: drawValue
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void drawValue(ChartValue radObject, Circle circle, Text text) {
String category = radObject.getCategory();
double value = radObject.getValue();
int index = -1;
double angleOfPoints = 360.0f / categoriesName.length;
double angle = -90;
for (int i = 0; i < categoriesName.length; i++) {
if (categoriesName[i].equals(category)) {
index = i;
break;
}
angle += angleOfPoints;
}
if (index == -1 || linesOfPoints == null || linesOfPoints.length == 0) {
return;
}
if (value >= minValue && value <= maxValue) {
double pos = value / maxValue;
double startX = linesOfPoints[index].getStartX();
double startY = linesOfPoints[index].getStartY();
double rad = angle * Math.PI / 180.0f;
double x = startX + (radius * pos) * Math.cos(rad);
double y = startY + (radius * pos) * Math.sin(rad);
radObject.setX(x);
radObject.setY(y);
circle.setCenterX(x);
circle.setCenterY(y);
circle.setRadius(POINTS_RADIUS);
circle.setFill(Color.RED);
text.setX(x + 5);
text.setY(y);
text.setText(String.valueOf(value));
text.setFont(Font.font(15));
getChildren().addAll(circle, text);
}
}
示例7: addXTickLine
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void addXTickLine(String value, double x, double y) {
Line line = new Line(x, y - 5, x, y + 5);
axisComponts.add(line);
Text text = new Text(value);
axisComponts.add(text);
text.setX(x - 5);
text.setY(y + 25);
getChildren().addAll(line, text);
}
示例8: createQuestionTransition
import javafx.scene.text.Text; //导入方法依赖的package包/类
private Transition createQuestionTransition(String question, List<Image> Pictos) {
Text questionText = new Text(question);
questionText.setId("title");
final Dimension2D gamePaneDimension2D = gameContext.getGamePanelDimensionProvider().getDimension2D();
double positionX = gamePaneDimension2D.getWidth() / 2 - questionText.getBoundsInParent().getWidth() * 2;
double positionY = gamePaneDimension2D.getHeight() / 2 - questionText.getBoundsInParent().getHeight() / 2;
questionText.setX(positionX);
questionText.setY(positionY);
questionText.setTextAlignment(TextAlignment.CENTER);
StackPane.setAlignment(questionText, Pos.CENTER);
gameContext.getChildren().add(questionText);
List<Rectangle> pictogramesList = new ArrayList<>(20); // storage of actual Pictogramm nodes in order to delete
// them
// from the group later
if (Pictos != null && !Pictos.isEmpty() && Pictos.size() <= NBMAXPICTO) {
double screenWidth = Screen.getPrimary().getBounds().getWidth();
double nbPicto = Pictos.size();
double pictoSize = screenWidth / (nbPicto + 1);
log.info("screenWidth/(nbPicto) : {}", pictoSize);
pictoSize = Math.min(pictoSize, MAXSIZEPICTO);
log.info("Picto Size: {}", pictoSize);
int i = 0;
double shift = screenWidth / 2 - ((nbPicto / 2) * pictoSize * 1.1);
log.info("shift Size: {}", shift);
for (Image I : Pictos) {
Rectangle R = new Rectangle(pictoSize, pictoSize);
R.setFill(new ImagePattern(I));
R.setY(positionY + 100);
R.setX(shift + (i++ * pictoSize * 1.1));
pictogramesList.add(R);
}
gameContext.getChildren().addAll(pictogramesList);
}
TranslateTransition fullAnimation = new TranslateTransition(
Duration.millis(ConfigurationBuilder.createFromPropertiesResource().build().getQuestionLength()),
questionText);
fullAnimation.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
gameContext.getChildren().remove(questionText);
gameContext.getChildren().removeAll(pictogramesList);
log.info("Adding {} pictures", currentRoundDetails.pictureCardList.size());
gameContext.getChildren().addAll(currentRoundDetails.pictureCardList);
for (PictureCard p : currentRoundDetails.pictureCardList) {
log.info("p = {}", p);
p.toFront();
p.setOpacity(1);
}
stats.start();
gameContext.onGameStarted();
}
});
return fullAnimation;
}