本文整理汇总了Java中javafx.scene.text.Text.setTextAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setTextAlignment方法的具体用法?Java Text.setTextAlignment怎么用?Java Text.setTextAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.text.Text
的用法示例。
在下文中一共展示了Text.setTextAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNumber
import javafx.scene.text.Text; //导入方法依赖的package包/类
private Text createNumber(String number, double layoutX, double layoutY) {
Text text = new Text(number);
text.setLayoutX(layoutX);
text.setLayoutY(layoutY);
text.setTextAlignment(TextAlignment.CENTER);
text.setFill(FILL_COLOR);
text.setFont(NUMBER_FONT);
return text;
}
示例2: addSeparator
import javafx.scene.text.Text; //导入方法依赖的package包/类
private Node addSeparator(String name) {
Separator separator = new Separator();
separator.setPadding(new Insets(8, 0, 0, 0));
HBox.setHgrow(separator, Priority.ALWAYS);
Text text = new Text(name);
text.setTextAlignment(TextAlignment.CENTER);
HBox hBox = new HBox(text, separator);
HBox.setHgrow(hBox, Priority.ALWAYS);
return hBox;
}
示例3: getActionPane
import javafx.scene.text.Text; //导入方法依赖的package包/类
private VBox getActionPane(){
progress= new Text("Office\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");
Image iconf= new Image(Office_Entry.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);
Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);
txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");
txtsearch= new TextField();
initFilter();
Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");
Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
setAddAttendance();
});
btnView.setOnAction(e -> {
timelineDown.play();
});
btnCloseView.setOnAction(e -> {
timelineUp.play();
});
VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);
HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);
VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));
HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
}
示例4: buildScene
import javafx.scene.text.Text; //导入方法依赖的package包/类
private Scene buildScene() {
VBox aboutBox = new VBox(properties.getAboutBoxSpacing());
Scene dialogScene = new Scene(aboutBox, properties.getAboutBoxWidth(), properties.getAboutBoxHeight());
Text text = new Text(localeService.getMessage("ui.menu.help.about.text"));
text.setTextAlignment(TextAlignment.CENTER);
text.setWrappingWidth(properties.getAboutBoxWidth());
aboutBox.getChildren().add(text);
return dialogScene;
}
示例5: setEndingScreen
import javafx.scene.text.Text; //导入方法依赖的package包/类
public GridPane setEndingScreen(){
GridPane endGrid = new GridPane();
endGrid.setAlignment(Pos.CENTER);
endGrid.setHgap(10);
endGrid.setVgap(10);
endGrid.setPrefWidth(300);
endGrid.setPrefHeight(150);
endGrid.setLayoutX((WIDTH-200)/2 - endGrid.getPrefWidth()/2);
endGrid.setLayoutY(HEIGHT/2 - endGrid.getPrefHeight()/2);
endGrid.setPadding(new Insets(25, 25, 25, 25));
endGrid.setStyle("-fx-background-color: #C0C0C0;");
Text scenetitle = new Text("Gratulálok, nyertél!\n\n Lépéseid száma: " + playGround.lepes);
scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
scenetitle.setTextAlignment(TextAlignment.CENTER);
endGrid.add(scenetitle, 0, 0, 2, 1);
Button btn = new Button("Hozzáadás a toplistához");
HBox hbBtn = new HBox(10);
hbBtn.setAlignment(Pos.BOTTOM_CENTER);
hbBtn.getChildren().add(btn);
endGrid.add(hbBtn, 1, 4);
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
PlayerImp.AddToHighScore(playGround.celban,playGround.lepes,playGround.datum, playGround.jatekosneve);
endGrid.setVisible(false);
}
});
return endGrid;
}
示例6: createWelcome
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void createWelcome(String genreName){
Text welcome = new Text(genreName + " " + myResources.getString("CREATION_ENVIRONMENT_SUFFIX"));
welcome.setFont(titleFont);
welcome.setWrappingWidth(WRAPPING_WIDTH);
welcome.setTextAlignment(TextAlignment.CENTER);
this.getChildren().add(welcome);
createUserData();
}
示例7: start
import javafx.scene.text.Text; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
loadData();
tree = new J48();
tree.buildClassifier(data);
noClassificationChart = buildChart("No Classification (click to add new data)", buildSingleSeries());
clusteredChart = buildChart("Clustered", buildClusteredSeries());
realDataChart = buildChart("Real Data (+ Decision Tree classification for new data)", buildLabeledSeries());
noClassificationChart.setOnMouseClicked(e -> {
Axis<Number> xAxis = noClassificationChart.getXAxis();
Axis<Number> yAxis = noClassificationChart.getYAxis();
Point2D mouseSceneCoords = new Point2D(e.getSceneX(), e.getSceneY());
double x = xAxis.sceneToLocal(mouseSceneCoords).getX();
double y = yAxis.sceneToLocal(mouseSceneCoords).getY();
Number xValue = xAxis.getValueForDisplay(x);
Number yValue = yAxis.getValueForDisplay(y);
reloadSeries(xValue, yValue);
});
Label lblDecisionTreeTitle = new Label("Decision Tree generated for the Iris dataset:");
Text txtTree = new Text(tree.toString());
String graph = tree.graph();
SwingNode sw = new SwingNode();
SwingUtilities.invokeLater(() -> {
TreeVisualizer treeVisualizer = new TreeVisualizer(null, graph, new PlaceNode2());
treeVisualizer.setPreferredSize(new Dimension(600, 500));
sw.setContent(treeVisualizer);
});
Button btnRestore = new Button("Restore original data");
Button btnSwapColors = new Button("Swap clustered chart colors");
StackPane spTree = new StackPane(sw);
spTree.setPrefWidth(300);
spTree.setPrefHeight(350);
VBox vbDecisionTree = new VBox(5, lblDecisionTreeTitle, new Separator(), spTree,
new HBox(10, btnRestore, btnSwapColors));
btnRestore.setOnAction(e -> {
loadData();
reloadSeries();
});
btnSwapColors.setOnAction(e -> swapClusteredChartSeriesColors());
lblDecisionTreeTitle.setTextFill(Color.DARKRED);
lblDecisionTreeTitle.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, 16));
txtTree.setTranslateX(100);
txtTree.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, 14));
txtTree.setLineSpacing(1);
txtTree.setTextAlignment(TextAlignment.LEFT);
vbDecisionTree.setTranslateY(20);
vbDecisionTree.setTranslateX(20);
GridPane gpRoot = new GridPane();
gpRoot.add(realDataChart, 0, 0);
gpRoot.add(clusteredChart, 1, 0);
gpRoot.add(noClassificationChart, 0, 1);
gpRoot.add(vbDecisionTree, 1, 1);
stage.setScene(new Scene(gpRoot));
stage.setTitle("Íris dataset clustering and visualization");
stage.show();
}
示例8: getActionPane
import javafx.scene.text.Text; //导入方法依赖的package包/类
private VBox getActionPane(){
progress= new Text("Gate\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");
Image iconf= new Image(AllAttendance.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);
Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);
txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");
txtsearch= new TextField();
initFilter();
Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
setAddAttendance();
});
Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");
btnView.setOnAction(e -> {
timelineDown.play();
});
btnCloseView.setOnAction(e -> {
timelineUp.play();
});
VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);
HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);
//btnadd was beside txtfinger
VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));
HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
}
示例9: 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;
}
示例10: setWelcomeScreen
import javafx.scene.text.Text; //导入方法依赖的package包/类
public GridPane setWelcomeScreen(){
GridPane welcomeGrid = new GridPane();
welcomeGrid.setAlignment(Pos.CENTER);
welcomeGrid.setHgap(10);
welcomeGrid.setVgap(10);
welcomeGrid.setPrefWidth(300);
welcomeGrid.setPrefHeight(150);
welcomeGrid.setLayoutX((WIDTH-200)/2 - welcomeGrid.getPrefWidth()/2);
welcomeGrid.setLayoutY(HEIGHT/2 - welcomeGrid.getPrefHeight()/2);
welcomeGrid.setPadding(new Insets(25, 25, 25, 25));
welcomeGrid.setStyle("-fx-background-color: #C0C0C0;");
Text welcomeScreenTitle = new Text("Üdvözöllek, \n kérlek írd be a beceneved.");
welcomeScreenTitle.setTextAlignment(TextAlignment.CENTER);
welcomeScreenTitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
welcomeGrid.add(welcomeScreenTitle, 0, 0, 2, 1);
Label nickName = new Label("Becenév:");
welcomeGrid.add(nickName, 0, 1);
TextField nickNameTextField = new TextField();
welcomeGrid.add(nickNameTextField, 1, 1);
Button startButton = new Button("Játék kezdése");
HBox btnHolder = new HBox(10);
btnHolder.setAlignment(Pos.BOTTOM_RIGHT);
btnHolder.getChildren().add(startButton);
welcomeGrid.add(btnHolder, 1, 4);
startButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
playGround.jatekosneve = nickNameTextField.getText();
playGround.kezdes = 1;
welcomeGrid.setVisible(false);
}
});
return welcomeGrid;
}
示例11: setupTitle
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void setupTitle(){
Text title = new Text(myResources.getString("generalGameData"));
title.setFont(new Font(40));
title.setTextAlignment(TextAlignment.CENTER);
this.setTop(title);
}
示例12: Balloon
import javafx.scene.text.Text; //导入方法依赖的package包/类
Balloon(String id, String text) {
instance=this;
bubbleShadow.setRadius(10.0);
bubbleShadow.setOffsetX(1.5);
bubbleShadow.setOffsetY(2.5);
bubbleShadow.setColor(Color.color(0, 0, 0, Main.getProperties().getFloat("balloon.shadow-opacity", 1.0f)));
Text label = new Text("");
label.setStyle("-fx-alignment: center; -fx-text-alignment: center; -fx-content-display: center;");
label.setTextAlignment(TextAlignment.CENTER);
label.setWrappingWidth(300);
if (defaultFont != null) {
label.setFont(defaultFont);
} else {
label.setFont(LocalFont.defaultFont);
}
Integer animation_delay = Main.getProperties().getInteger("balloon.text-animation-delay", 50);
if (animation_delay > 0)
symbolsAdder = new SymbolsAdder(text, animation_delay);
else
label.setText(text);
content = label;
StackPane contentPane = new StackPane();
contentPane.getChildren().add(content);
bubblesGroup = new Group(bubbleShapes);
stackPane.getChildren().add(bubblesGroup);
stackPane.getChildren().add(contentPane);
StackPane.setMargin(content, margin);
setBalloonScaleFactor(Main.getProperties().getFloat("balloon.scale_factor", 100));
getChildren().add(stackPane);
setBalloonOpacity(Main.getProperties().getFloat("balloon.opacity", 100));
setOnMousePressed(event -> {
lastClick = System.currentTimeMillis();
if ((positionMode != PositionMode.AUTO) && event.getButton().equals(MouseButton.PRIMARY)) {
startDrag(event);
}
});
setOnMouseReleased(event -> {
if(!isDragging() && event.getButton().equals(MouseButton.PRIMARY) && (System.currentTimeMillis()-lastClick)<200) {
if (character != null) {
character.say(null);
} else {
close();
}
}
});
setOnMouseEntered(event -> {
if (character != null && timeoutTimeline != null) {
timeoutTimeline.stop();
}
});
setOnMouseExited(event -> {
if (character != null && timeoutTimeline != null) {
timeoutTimeline.play();
}
});
mouseEventNotificator
.setOnClickListener()
.setOnMovedListener()
// TODO: Figure out how to write more precise check.
.setOnScrollListener(event -> true);
}
示例13: setKeyFormat
import javafx.scene.text.Text; //导入方法依赖的package包/类
public void setKeyFormat(Text control){
control.prefWidth(controlLength);
control.setFont(Font.font(null, FontWeight.BOLD, 12));
control.setFill(Color.DARKGRAY);
control.setTextAlignment(TextAlignment.RIGHT);
}
示例14: setValueFormat
import javafx.scene.text.Text; //导入方法依赖的package包/类
public void setValueFormat(Text control){
control.prefWidth(controlLength);
control.setFont(Font.font(null, FontWeight.NORMAL, 12));
control.setTextAlignment(TextAlignment.LEFT);
}
示例15: 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;
}