本文整理汇总了Java中javafx.scene.control.Label.setLayoutY方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setLayoutY方法的具体用法?Java Label.setLayoutY怎么用?Java Label.setLayoutY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setLayoutY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MyNode
import javafx.scene.control.Label; //导入方法依赖的package包/类
public MyNode(String name) {
text = new Label(name);
text.setStyle("-fx-border-color:black; -fx-padding:3px;");
text.setLayoutX(4);
text.setLayoutY(2);
getChildren().addAll(text);
}
示例2: buildMainMenu
import javafx.scene.control.Label; //导入方法依赖的package包/类
private void buildMainMenu(Group root, Scene scene, Dimension screenSize) {
// Main title
Label maintitle = new Label();
maintitle.setText("Chess Master");
maintitle.setFont(new Font("Arial", MAIN_TITLE_FONT_SIZE));
maintitle.setLayoutX(MAIN_TITLE_LEFT_PADDING);
maintitle.setLayoutY(MAIN_TITLE_TOP_PADDING);
root.getChildren().add(maintitle);
// Buttons
Group buttonsGroup = new Group();
// Start button.
Button choiceGameButton = new Button();
choiceGameButton.setLayoutX(screenSize.getWidth() * BUTTON_LEFT_PADDING);
choiceGameButton.setLayoutY(maintitle.getLayoutY() * 2);
choiceGameButton.setPrefSize(BUTTONS_WIDTH, BUTTONS_HEIGHT);
choiceGameButton.setText("Choose your game");
buttonsGroup.getChildren().add(choiceGameButton);
// Setting button.
Button settingButton = new Button();
settingButton.setLayoutX(screenSize.getWidth() * BUTTON_LEFT_PADDING);
settingButton.setLayoutY(choiceGameButton.getLayoutY() + BUTTONS_SPACE);
settingButton.setPrefSize(BUTTONS_WIDTH, BUTTONS_HEIGHT);
settingButton.setText("Settings");
buttonsGroup.getChildren().add(settingButton);
// Quit button.
Button quitButton = new Button();
quitButton.setLayoutX(screenSize.getWidth() * BUTTON_LEFT_PADDING);
quitButton.setLayoutY(settingButton.getLayoutY() + BUTTONS_SPACE);
quitButton.setPrefSize(BUTTONS_WIDTH, BUTTONS_HEIGHT);
quitButton.setText("Quit game");
quitButton.setOnAction(handle -> closeApp());
buttonsGroup.getChildren().add(quitButton);
root.getChildren().add(buttonsGroup);
// Copyright
Label copyright = new Label();
copyright.setText("All rights reserved, Nicolas GILLE, 2017");
copyright.setFont(new Font("Arial", 12));
copyright.setLayoutX(COPYRIGHT_LEFT_PADDING);
copyright.setLayoutY(COPYRIGHT_TOP_PADDING);
root.getChildren().add(copyright);
}
示例3: createLinesAndCategories
import javafx.scene.control.Label; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void createLinesAndCategories(ArrayList<double[]> shapeCordsList) {
int index = 0;
for (int i = 0; i < categoriesName.length; i++) {
double xPlus = 0;
double yPlus = 0;
double x = shapeCordsList.get(0)[index];
double y = shapeCordsList.get(0)[index + 1];
HBox pane = new HBox();
Label categoryLabel = new Label(categoriesName[i]);
categoryLabel.setStyle("-fx-text-fill:black");
categoryLabel.setFont(Font.font(15));
pane.getChildren().add(categoryLabel);
@SuppressWarnings("unused")
Scene s = new Scene(pane);
categoryLabel.impl_processCSS(true);
double labelWidth = categoryLabel.prefWidth(-1);
double labelHeight = categoryLabel.prefHeight(-1);
pane.getChildren().clear();
if (x < xCenter) {
xPlus = -labelWidth;
}
if (y < yCenter) {
yPlus = -labelHeight;
}
categoryLabel.setLayoutX(x + xPlus);
categoryLabel.setLayoutY(y + yPlus);
getChildren().add(categoryLabel);
index = index + 2;
}
}