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


Java Group.setTranslateX方法代碼示例

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


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

示例1: createRectangle

import javafx.scene.Group; //導入方法依賴的package包/類
public static Group createRectangle(Color color, double tx, double ty, double sx, double sy) {
    Group squareGroup = new Group();
    Rectangle squareShape = new Rectangle(1.0, 1.0);
    squareShape.setFill(color);
    squareShape.setTranslateX(-0.5);
    squareShape.setTranslateY(-0.5);
    squareGroup.getChildren().add(squareShape);
    squareGroup.setTranslateX(tx);
    squareGroup.setTranslateY(ty);
    squareGroup.setScaleX(sx);
    squareGroup.setScaleY(sy);
    return squareGroup;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:Xylophone.java

示例2: initializeLocationTypeIndicatorArrows

import javafx.scene.Group; //導入方法依賴的package包/類
private void initializeLocationTypeIndicatorArrows() {

        // Initial indicator
        final Group initialLocationGuideContainer = controller.initialLocationGuideContainer;
        final Path initialLocationGuideArrow = controller.initialLocationGuideArrow;
        final Label initialLocationGuideLabel = controller.initialLocationGuideLabel;

        drawIndicatorArrow(initialLocationGuideArrow);
        initialLocationGuideContainer.setRotate(-45-90);
        initialLocationGuideContainer.setTranslateX(2.3 * GRID_SIZE);
        initialLocationGuideContainer.setTranslateY(3.8 * GRID_SIZE);
        initialLocationGuideLabel.setRotate(180);
        initialLocationGuideLabel.setTranslateY(10.5);
        initialLocationGuideContainer.toFront();
        initialLocationGuideContainer.setOpacity(0);

        // Final indicator
        final Group finalLocationGuideContainer = controller.finalLocationGuideContainer;
        final Path finalLocationGuideArrow = controller.finalLocationGuideArrow;
        final Label finalLocationGuideLabel = controller.finalLocationGuideLabel;

        drawIndicatorArrow(finalLocationGuideArrow);
        finalLocationGuideContainer.setRotate(45);
        finalLocationGuideContainer.setTranslateX(-2.3 * GRID_SIZE);
        finalLocationGuideContainer.setTranslateY(-3.8 * GRID_SIZE);
        finalLocationGuideLabel.setTranslateY(10.5);
        finalLocationGuideContainer.toFront();
        finalLocationGuideContainer.setOpacity(0);

        if (!controller.getComponent().isFirsTimeShown()) {
            initialLocationGuideContainer.setOpacity(1);
            finalLocationGuideContainer.setOpacity(1);
            playIndicatorAnimations(Location.Type.INITIAL, initialLocationGuideContainer);
            playIndicatorAnimations(Location.Type.FINAl, finalLocationGuideContainer);
            controller.getComponent().setFirsTimeShown(true);
        }


    }
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:40,代碼來源:ComponentPresentation.java

示例3: initInfoPanel

import javafx.scene.Group; //導入方法依賴的package包/類
private void initInfoPanel() {
    infoPanel = new Group();
    roundCaption = new Text();
    roundCaption.setText("ROUND");
    roundCaption.setTextOrigin(VPos.TOP);
    roundCaption.setFill(Color.rgb(51, 102, 51));
    Font f = new Font("Impact", 18);
    roundCaption.setFont(f);
    roundCaption.setTranslateX(30);
    roundCaption.setTranslateY(128);
    round = new Text();
    round.setTranslateX(roundCaption.getTranslateX() +
        roundCaption.getBoundsInLocal().getWidth() + Config.INFO_TEXT_SPACE);
    round.setTranslateY(roundCaption.getTranslateY());
    round.setText(levelNumber + "");
    round.setTextOrigin(VPos.TOP);
    round.setFont(f);
    round.setFill(Color.rgb(0, 204, 102));
    scoreCaption = new Text();
    scoreCaption.setText("SCORE");
    scoreCaption.setFill(Color.rgb(51, 102, 51));
    scoreCaption.setTranslateX(30);
    scoreCaption.setTranslateY(164);
    scoreCaption.setTextOrigin(VPos.TOP);
    scoreCaption.setFont(f);
    score = new Text();
    score.setTranslateX(scoreCaption.getTranslateX() +
        scoreCaption.getBoundsInLocal().getWidth() + Config.INFO_TEXT_SPACE);
    score.setTranslateY(scoreCaption.getTranslateY());
    score.setFill(Color.rgb(0, 204, 102));
    score.setTextOrigin(VPos.TOP);
    score.setFont(f);
    score.setText("");
    livesCaption = new Text();
    livesCaption.setText("LIFE");
    livesCaption.setTranslateX(30);
    livesCaption.setTranslateY(200);
    livesCaption.setFill(Color.rgb(51, 102, 51));
    livesCaption.setTextOrigin(VPos.TOP);
    livesCaption.setFont(f);
    Color INFO_LEGEND_COLOR = Color.rgb(0, 114, 188);
    int infoWidth = Config.SCREEN_WIDTH - Config.FIELD_WIDTH;
    Rectangle black = new Rectangle();
    black.setWidth(infoWidth);
    black.setHeight(Config.SCREEN_HEIGHT);
    black.setFill(Color.BLACK);
    ImageView verLine = new ImageView();
    verLine.setImage(new Image(Level.class.getResourceAsStream(Config.IMAGE_DIR+"vline.png")));
    verLine.setTranslateX(3);
    ImageView logo = new ImageView();
    logo.setImage(Config.getImages().get(Config.IMAGE_LOGO));
    logo.setTranslateX(30);
    logo.setTranslateY(30);
    Text legend = new Text();
    legend.setTranslateX(30);
    legend.setTranslateY(310);
    legend.setText("LEGEND");
    legend.setFill(INFO_LEGEND_COLOR);
    legend.setTextOrigin(VPos.TOP);
    legend.setFont(new Font("Impact", 18));
    infoPanel.getChildren().addAll(black, verLine, logo, roundCaption,
            round, scoreCaption, score, livesCaption, legend);
    for (int i = 0; i < Bonus.COUNT; i++) {
        Bonus bonus = new Bonus(i);
        Text text = new Text();
        text.setTranslateX(100);
        text.setTranslateY(350 + i * 40);
        text.setText(Bonus.NAMES[i]);
        text.setFill(INFO_LEGEND_COLOR);
        text.setTextOrigin(VPos.TOP);
        text.setFont(new Font("Arial", 12));
        bonus.setTranslateX(30 + (820 - 750 - bonus.getWidth()) / 2);
        bonus.setTranslateY(text.getTranslateY() -
            (bonus.getHeight() - text.getBoundsInLocal().getHeight()) / 2);
        // Workaround JFXC-2379
        infoPanel.getChildren().addAll(bonus, text);
    }
    infoPanel.setTranslateX(Config.FIELD_WIDTH);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:80,代碼來源:Level.java


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