本文整理汇总了Java中javafx.scene.text.Text.setTranslateY方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setTranslateY方法的具体用法?Java Text.setTranslateY怎么用?Java Text.setTranslateY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.text.Text
的用法示例。
在下文中一共展示了Text.setTranslateY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLetter
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void createLetter(String c) {
final Text letter = new Text(c);
letter.setFill(Color.BLACK);
letter.setFont(FONT_DEFAULT);
letter.setTextOrigin(VPos.TOP);
letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
getChildren().add(letter);
// over 3 seconds move letter to random position and fade it out
final Timeline timeline = new Timeline();
timeline.getKeyFrames().add(
new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
// we are done remove us from scene
getChildren().remove(letter);
}
},
new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
new KeyValue(letter.opacityProperty(), 0f)
));
timeline.play();
}
示例2: displayLetter
import javafx.scene.text.Text; //导入方法依赖的package包/类
public static void displayLetter(Pane parent, LetterInterface letter, boolean draggable) {
Text tileText = new Text(LetterToStringTransformer.transform(letter));
tileText.getStyleClass().add("tile-letter");
Text tileValue = new Text(String.valueOf(letter.getValue()));
tileValue.getStyleClass().add("tile-value");
tileValue.setTranslateX(8);
tileValue.setTranslateY(10);
StackPane tile = new StackPane(tileText, tileValue);
tile.getStyleClass().add("tile");
if (draggable) {
DraggableLetterManager.makeLetterDraggable(tile, letter);
}
parent.getChildren().add(tile);
}
示例3: initInfoPanel
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void initInfoPanel() {
infoPanel = new Group();
roundCaption = new Text();
roundCaption.setText("ROUND");
roundCaption.setTextOrigin(VPos.TOP);
roundCaption.setFill(Color.rgb(51, 102, 51));
Font f = new Font("Impact", 18);
roundCaption.setFont(f);
roundCaption.setTranslateX(30);
roundCaption.setTranslateY(128);
round = new Text();
round.setTranslateX(roundCaption.getTranslateX() +
roundCaption.getBoundsInLocal().getWidth() + Config.INFO_TEXT_SPACE);
round.setTranslateY(roundCaption.getTranslateY());
round.setText(levelNumber + "");
round.setTextOrigin(VPos.TOP);
round.setFont(f);
round.setFill(Color.rgb(0, 204, 102));
scoreCaption = new Text();
scoreCaption.setText("SCORE");
scoreCaption.setFill(Color.rgb(51, 102, 51));
scoreCaption.setTranslateX(30);
scoreCaption.setTranslateY(164);
scoreCaption.setTextOrigin(VPos.TOP);
scoreCaption.setFont(f);
score = new Text();
score.setTranslateX(scoreCaption.getTranslateX() +
scoreCaption.getBoundsInLocal().getWidth() + Config.INFO_TEXT_SPACE);
score.setTranslateY(scoreCaption.getTranslateY());
score.setFill(Color.rgb(0, 204, 102));
score.setTextOrigin(VPos.TOP);
score.setFont(f);
score.setText("");
livesCaption = new Text();
livesCaption.setText("LIFE");
livesCaption.setTranslateX(30);
livesCaption.setTranslateY(200);
livesCaption.setFill(Color.rgb(51, 102, 51));
livesCaption.setTextOrigin(VPos.TOP);
livesCaption.setFont(f);
Color INFO_LEGEND_COLOR = Color.rgb(0, 114, 188);
int infoWidth = Config.SCREEN_WIDTH - Config.FIELD_WIDTH;
Rectangle black = new Rectangle();
black.setWidth(infoWidth);
black.setHeight(Config.SCREEN_HEIGHT);
black.setFill(Color.BLACK);
ImageView verLine = new ImageView();
verLine.setImage(new Image(Level.class.getResourceAsStream(Config.IMAGE_DIR+"vline.png")));
verLine.setTranslateX(3);
ImageView logo = new ImageView();
logo.setImage(Config.getImages().get(Config.IMAGE_LOGO));
logo.setTranslateX(30);
logo.setTranslateY(30);
Text legend = new Text();
legend.setTranslateX(30);
legend.setTranslateY(310);
legend.setText("LEGEND");
legend.setFill(INFO_LEGEND_COLOR);
legend.setTextOrigin(VPos.TOP);
legend.setFont(new Font("Impact", 18));
infoPanel.getChildren().addAll(black, verLine, logo, roundCaption,
round, scoreCaption, score, livesCaption, legend);
for (int i = 0; i < Bonus.COUNT; i++) {
Bonus bonus = new Bonus(i);
Text text = new Text();
text.setTranslateX(100);
text.setTranslateY(350 + i * 40);
text.setText(Bonus.NAMES[i]);
text.setFill(INFO_LEGEND_COLOR);
text.setTextOrigin(VPos.TOP);
text.setFont(new Font("Arial", 12));
bonus.setTranslateX(30 + (820 - 750 - bonus.getWidth()) / 2);
bonus.setTranslateY(text.getTranslateY() -
(bonus.getHeight() - text.getBoundsInLocal().getHeight()) / 2);
// Workaround JFXC-2379
infoPanel.getChildren().addAll(bonus, text);
}
infoPanel.setTranslateX(Config.FIELD_WIDTH);
}
示例4: setRightBlock
import javafx.scene.text.Text; //导入方法依赖的package包/类
public VBox setRightBlock(){
VBox jobb = new VBox(10);
jobb.setSpacing(10);
jobb.setPrefWidth(200);
jobb.setPrefHeight(500);
jobb.setLayoutX(WIDTH-200);
Button gomb = new Button("Játék újrakezdése");
gomb.setPrefWidth(150);
gomb.setPadding(new Insets(10, 10, 10, 10));
gomb.setTranslateX((jobb.getPrefWidth()-gomb.getPrefWidth())/2);
gomb.setTranslateY(50);
jobb.setStyle("-fx-background-color: #c2c2d6;");
jobb.getChildren().add(gomb);
Text manualTitle = new Text("Irányítás:");
manualTitle.setTranslateX(50);
manualTitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
manualTitle.setTranslateY(100);
jobb.getChildren().add(manualTitle);
GridPane moveHolder = new GridPane();
moveHolder.setAlignment(Pos.CENTER);
moveHolder.setHgap(10);
moveHolder.setVgap(10);
moveHolder.setPrefWidth(200);
moveHolder.setPrefHeight(400);
Text moveUp = new Text("↑ - Felfele lépés");
moveUp.setTextAlignment(TextAlignment.CENTER);
moveUp.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveUp, 0, 0, 2, 1);
Text moveDown = new Text("↓ - Lefele lépés");
moveDown.setTextAlignment(TextAlignment.CENTER);
moveDown.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveDown, 0, 1, 2, 1);
Text moveLeft = new Text("← - Balra lépés");
moveLeft.setTextAlignment(TextAlignment.CENTER);
moveLeft.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveLeft, 0, 2, 2, 1);
Text moveRight = new Text("→ - Jobbra lépés");
moveRight.setTextAlignment(TextAlignment.CENTER);
moveRight.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveRight, 0, 3, 2, 1);
jobb.getChildren().add(moveHolder);
gomb.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
playGround.lepes = 0;
playGround.celban = 0;
playGround.getDatum();
playGround.resetPlayGround();
updatePlayGround();
playGround.nyertes = 0;
playGround.kezdes = 1;
}
});
return jobb;
}