當前位置: 首頁>>代碼示例>>Java>>正文


Java Label.setLayoutY方法代碼示例

本文整理匯總了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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:8,代碼來源:CustomNodeSample.java

示例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);
}
 
開發者ID:Kero76,項目名稱:chess-master,代碼行數:47,代碼來源:View.java

示例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;
	}

}
 
開發者ID:JKostikiadis,項目名稱:PolygonChart,代碼行數:45,代碼來源:PolygonChart.java


注:本文中的javafx.scene.control.Label.setLayoutY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。