本文整理匯總了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;
}
}