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


Java Text.setLayoutY方法代碼示例

本文整理匯總了Java中javafx.scene.text.Text.setLayoutY方法的典型用法代碼示例。如果您正苦於以下問題:Java Text.setLayoutY方法的具體用法?Java Text.setLayoutY怎麽用?Java Text.setLayoutY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.text.Text的用法示例。


在下文中一共展示了Text.setLayoutY方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createIconContent

import javafx.scene.text.Text; //導入方法依賴的package包/類
public static Node createIconContent() {

        Text htmlStart = new Text("<html>");
        Text htmlEnd = new Text("</html>");
        htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlStart.setStyle("-fx-font-size: 20px;");
        htmlStart.setTextOrigin(VPos.TOP);
        htmlStart.setLayoutY(11);
        htmlStart.setLayoutX(20);

        htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlEnd.setStyle("-fx-font-size: 20px;");
        htmlEnd.setTextOrigin(VPos.TOP);
        htmlEnd.setLayoutY(31);
        htmlEnd.setLayoutX(20);

        return new Group(htmlStart, htmlEnd);
    }
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:HTMLEditorSample.java

示例2: createIconContent

import javafx.scene.text.Text; //導入方法依賴的package包/類
public static Node createIconContent() {
    Text text = new Text("abc");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(10);
    text.setLayoutY(11);
    text.setFill(Color.BLACK);
    text.setOpacity(0.5);
    text.setFont(Font.font(null, FontWeight.BOLD, 20));
    text.setStyle("-fx-font-size: 20px;");

    Text text2 = new Text("abc");
    text2.setTextOrigin(VPos.TOP);
    text2.setLayoutX(28);
    text2.setLayoutY(51);
    text2.setFill(Color.BLACK);
    text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
    text2.setStyle("-fx-font-size: 20px;");
            
    Line line = new Line(30, 32, 45, 57);
    line.setStroke(Color.DARKMAGENTA);

    return new javafx.scene.Group(text, line, text2);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:24,代碼來源:StringBindingSample.java

示例3: 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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:StopWatch.java

示例4: createDot

import javafx.scene.text.Text; //導入方法依賴的package包/類
private Text createDot(String string) {
    Text text = new Text(string);
    text.setFill(Color.web("#000000"));
    text.setFont(FONT);
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(1);
    text.setLayoutY(-4);
    return text;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:StopWatch.java

示例5: LettersPane

import javafx.scene.text.Text; //導入方法依賴的package包/類
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {
        
        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {
        
        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:KeyStrokeMotion.java

示例6: MyEnsembleNode

import javafx.scene.text.Text; //導入方法依賴的package包/類
public MyEnsembleNode(String name) {
  text = new Text(name);
  text.setTextOrigin(VPos.TOP);
  text.setLayoutX(4);
  text.setLayoutY(2);
  rectangle = new Rectangle(50, 20, Color.WHITESMOKE);
  rectangle.setStroke(Color.BLACK);
  //add nodes as childrens, order matters, first is on the bottom
  getChildren().addAll(rectangle, text);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:11,代碼來源:CustomNodeSample.java

示例7: createIconContent

import javafx.scene.text.Text; //導入方法依賴的package包/類
public static Node createIconContent() {
    MyEnsembleNode myNode = new MyEnsembleNode("MyNode");
    myNode.setLayoutY(50);
    MyEnsembleNode parent = new MyEnsembleNode("Parent");
    Polygon arrow = createUMLArrow();
    arrow.setLayoutY(20);
    arrow.setLayoutX(25-7.5);
    Text text = new Text("<<extends>>");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutY(31);
    text.setLayoutX(30);
    return new Group(parent, arrow, text, myNode);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:CustomNodeSample.java

示例8: WelcomeScene

import javafx.scene.text.Text; //導入方法依賴的package包/類
public WelcomeScene(PongApplication application) throws NullPointerException {
	super(new Group(), RESOLUTION_WIDTH, RESOLUTION_HEIGHT);

	requireNonNull(application, "The application cannot be null!");

	topicText = new Text("JavaFX Pong");
	topicText.setTextOrigin(VPos.CENTER);
	topicText.setFont(BIG_FONT);
	topicText.setLayoutX((RESOLUTION_WIDTH - topicText.prefWidth(-1)) / 2);
	topicText.setLayoutY(RESOLUTION_HEIGHT / 6);
	topicText.setFill(Color.WHITE);

	leftControlsTopicText = new Text("Controls for the left player:");
	leftControlsTopicText.setTextOrigin(VPos.CENTER);
	leftControlsTopicText.setFont(SMALL_FONT);
	leftControlsTopicText.setLayoutX((RESOLUTION_WIDTH - leftControlsTopicText.prefWidth(-1)) / 2);
	leftControlsTopicText.setLayoutY(topicText.getLayoutY() + 100);
	leftControlsTopicText.setFill(Color.WHITE);

	leftControlsText = new Text("W and S");
	leftControlsText.setTextOrigin(VPos.CENTER);
	leftControlsText.setFont(SMALL_FONT);
	leftControlsText.setLayoutX((RESOLUTION_WIDTH - leftControlsText.prefWidth(-1)) / 2);
	leftControlsText.setLayoutY(leftControlsTopicText.getLayoutY() + 40);
	leftControlsText.setFill(Color.WHITE);

	rightControlsTopicText = new Text("Controls for the right player:");
	rightControlsTopicText.setTextOrigin(VPos.CENTER);
	rightControlsTopicText.setFont(SMALL_FONT);
	rightControlsTopicText.setLayoutX((RESOLUTION_WIDTH - rightControlsTopicText.prefWidth(-1)) / 2);
	rightControlsTopicText.setLayoutY(leftControlsText.getLayoutY() + 60);
	rightControlsTopicText.setFill(Color.WHITE);

	rightControlsText = new Text("UP-ARROW and DOWN-ARROW");
	rightControlsText.setTextOrigin(VPos.CENTER);
	rightControlsText.setFont(SMALL_FONT);
	rightControlsText.setLayoutX((RESOLUTION_WIDTH - rightControlsText.prefWidth(-1)) / 2);
	rightControlsText.setLayoutY(rightControlsTopicText.getLayoutY() + 40);
	rightControlsText.setFill(Color.WHITE);

	proceedInstructionsText = new Text("Press [ENTER] to start the match");
	proceedInstructionsText.setTextOrigin(VPos.CENTER);
	proceedInstructionsText.setFont(SMALL_FONT);
	proceedInstructionsText.setLayoutX((RESOLUTION_WIDTH - proceedInstructionsText.prefWidth(-1)) / 2);
	proceedInstructionsText.setLayoutY(rightControlsTopicText.getLayoutY() + 160);
	proceedInstructionsText.setFill(Color.WHITE);

	Parent root = getRoot();
	if (!(root instanceof Group)) {
		throw new AssertionError("The scene root is not a Group instance!");
	}

	Group rootGroup = (Group) root;
	ObservableList<Node> children = rootGroup.getChildren();
	children.add(topicText);
	children.add(leftControlsTopicText);
	children.add(leftControlsText);
	children.add(rightControlsTopicText);
	children.add(rightControlsText);
	children.add(proceedInstructionsText);

	setOnKeyReleased(x -> {
		if (x.getCode() == KeyCode.ENTER) {
			// move into the court scene so we can start the game.
			Stage primaryStage = application.getPrimaryStage();
			primaryStage.setScene(new CourtScene(application));
		}
	});

	setFill(Color.BLACK);
}
 
開發者ID:toivjon,項目名稱:javafx-pong,代碼行數:72,代碼來源:WelcomeScene.java

示例9: EndGameScene

import javafx.scene.text.Text; //導入方法依賴的package包/類
public EndGameScene(PongApplication application) throws NullPointerException {
	super(new Group(), RESOLUTION_WIDTH, RESOLUTION_HEIGHT);

	requireNonNull(application, "The application cannot be null!");

	// get player scores from the session context.
	PongContext ctx = requireNonNull(application.getContext(), "The context cannot be null!");
	int p1Score = ctx.getPlayer1Score();
	int p2Score = ctx.getPlayer2Score();

	topicText = new Text("JavaFX Pong - Results");
	topicText.setTextOrigin(VPos.CENTER);
	topicText.setFont(BIG_FONT);
	topicText.setLayoutX((RESOLUTION_WIDTH - topicText.prefWidth(-1)) / 2);
	topicText.setLayoutY(RESOLUTION_HEIGHT / 6);
	topicText.setFill(Color.WHITE);

	gameHasEndedText = new Text("Game has ended");
	gameHasEndedText.setTextOrigin(VPos.CENTER);
	gameHasEndedText.setFont(SMALL_FONT);
	gameHasEndedText.setLayoutX((RESOLUTION_WIDTH - gameHasEndedText.prefWidth(-1)) / 2);
	gameHasEndedText.setLayoutY(topicText.getLayoutY() + 100);
	gameHasEndedText.setFill(Color.WHITE);

	winnerText = new Text((p1Score > p2Score ? "Right" : "Left") + " player won the game!");
	winnerText.setTextOrigin(VPos.CENTER);
	winnerText.setFont(SMALL_FONT);
	winnerText.setLayoutX((RESOLUTION_WIDTH - winnerText.prefWidth(-1)) / 2);
	winnerText.setLayoutY(gameHasEndedText.getLayoutY() + 40);
	winnerText.setFill(Color.WHITE);

	resultsTopicText = new Text("End results:");
	resultsTopicText.setTextOrigin(VPos.CENTER);
	resultsTopicText.setFont(SMALL_FONT);
	resultsTopicText.setLayoutX((RESOLUTION_WIDTH - resultsTopicText.prefWidth(-1)) / 2);
	resultsTopicText.setLayoutY(winnerText.getLayoutY() + 40);
	resultsTopicText.setFill(Color.WHITE);

	resultsText = new Text("" + ctx.getPlayer2Score() + " - " + ctx.getPlayer1Score());
	resultsText.setTextOrigin(VPos.CENTER);
	resultsText.setFont(SMALL_FONT);
	resultsText.setLayoutX((RESOLUTION_WIDTH - resultsText.prefWidth(-1)) / 2);
	resultsText.setLayoutY(resultsTopicText.getLayoutY() + 40);
	resultsText.setFill(Color.WHITE);

	proceedInstructionsText = new Text("Press [ENTER] to proceed");
	proceedInstructionsText.setTextOrigin(VPos.CENTER);
	proceedInstructionsText.setFont(SMALL_FONT);
	proceedInstructionsText.setLayoutX((RESOLUTION_WIDTH - proceedInstructionsText.prefWidth(-1)) / 2);
	proceedInstructionsText.setLayoutY(resultsText.getLayoutY() + 160);
	proceedInstructionsText.setFill(Color.WHITE);

	Parent root = getRoot();
	if (!(root instanceof Group)) {
		throw new AssertionError("The scene root is not a Group instance!");
	}

	Group rootGroup = (Group) root;
	ObservableList<Node> children = rootGroup.getChildren();
	children.add(topicText);
	children.add(gameHasEndedText);
	children.add(winnerText);
	children.add(resultsTopicText);
	children.add(resultsText);
	children.add(proceedInstructionsText);

	setOnKeyReleased(x -> {
		if (x.getCode() == KeyCode.ENTER) {
			// reset the game state and move into the welcoming scene.
			ctx.reset();
			Stage primaryStage = application.getPrimaryStage();
			primaryStage.setScene(new WelcomeScene(application));
		}
	});

	setFill(Color.BLACK);
}
 
開發者ID:toivjon,項目名稱:javafx-pong,代碼行數:78,代碼來源:EndGameScene.java


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