当前位置: 首页>>代码示例>>Java>>正文


Java HBox.setTranslateY方法代码示例

本文整理汇总了Java中javafx.scene.layout.HBox.setTranslateY方法的典型用法代码示例。如果您正苦于以下问题:Java HBox.setTranslateY方法的具体用法?Java HBox.setTranslateY怎么用?Java HBox.setTranslateY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.HBox的用法示例。


在下文中一共展示了HBox.setTranslateY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ColorButtonSample

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public ColorButtonSample() {
    HBox hBox = new HBox();
    hBox.setSpacing(5);
    for(int i=0; i<7; i++) {
        Button b = new Button("Color");
        b.setStyle("-fx-base: rgb("+(10*i)+","+(20*i)+","+(10*i)+");");
        hBox.getChildren().add(b);
    }
    HBox hBox2 = new HBox();
    hBox2.setSpacing(5);
    hBox2.setTranslateY(30);
    Button red = new Button("Red");
    red.setStyle("-fx-base: red;");
    Button orange = new Button("Orange");
    orange.setStyle("-fx-base: orange;");
    Button yellow = new Button("Yellow");
    yellow.setStyle("-fx-base: yellow;");
    Button green = new Button("Green");
    green.setStyle("-fx-base: green;");
    Button blue = new Button("Blue");
    blue.setStyle("-fx-base: rgb(30,170,255);");
    Button indigo = new Button("Indigo");
    indigo.setStyle("-fx-base: blue;");
    Button violet = new Button("Violet");
    violet.setStyle("-fx-base: purple;");
    hBox2.getChildren().add(red);
    hBox2.getChildren().add(orange);
    hBox2.getChildren().add(yellow);
    hBox2.getChildren().add(green);
    hBox2.getChildren().add(blue);
    hBox2.getChildren().add(indigo);
    hBox2.getChildren().add(violet);

    VBox vBox = new VBox(20);
    vBox.getChildren().addAll(hBox,hBox2);
    getChildren().add(vBox);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:38,代码来源:ColorButtonSample.java

示例2: createHorizontalBox

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public static HBox createHorizontalBox(double width, double height, double translateX, double translateY, String style)
{
	HBox box = createHorizontalBox(width, height, style);
	box.setTranslateX(translateX);
	box.setTranslateY(translateY);
	return box;
}
 
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:8,代码来源:JavaFxHelper.java

示例3: initBoxes

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void initBoxes(Pane root, Scene scene) {
    VBox vBox = Nodes.TEXT_VBOX;
    HBox hBox = Nodes.TEXTBAR_HBOX;
    ScrollPane scrollPane = Nodes.SCROLL_PANE;

    vBox.setTranslateY(10);
    vBox.setTranslateX(10);
    vBox.prefWidthProperty().bind(scene.widthProperty().subtract(10));
    vBox.prefHeightProperty().bind(scene.heightProperty().subtract(20).subtract(preferences.getDouble("textbar-height")));
    vBox.setSpacing((preferences.getDouble("messages-spacing-level") - 1)*10-5);


    hBox.setPrefWidth(scene.getWidth());
    hBox.setPrefHeight(preferences.getDouble("textbar-height"));
    hBox.setTranslateY(scene.getHeight() - hBox.getPrefHeight());
    hBox.setSpacing(20);

    root.widthProperty().addListener(o -> hBox.setPrefWidth(root.getWidth()));
    root.heightProperty().addListener(o -> hBox.setTranslateY(scene.getHeight() - Nodes.TEXTBAR_HBOX.getPrefHeight()));

    scrollPane.setContent(vBox);
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setTranslateX(vBox.getTranslateX());
    scrollPane.setTranslateY(vBox.getTranslateY());
    scrollPane.maxWidthProperty().bind(vBox.prefWidthProperty());
    scrollPane.prefWidthProperty().bind(vBox.prefWidthProperty());
    scrollPane.prefHeightProperty().bind(vBox.prefHeightProperty());
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
}
 
开发者ID:iAmGio,项目名称:jrfl,代码行数:32,代码来源:Jrfl.java

示例4: drawRestroom

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public void drawRestroom() { // Toilet and sink
    // Draw toilet
    Rectangle rgTL = new Rectangle(WIDTH / 8, (HEIGHT / (HEIGHT / 4)));
    rgTL.setFill(Color.web("a5a5a5"));
    gToilet.getChildren().add(rgTL);
    
    Rectangle rgTT = new Rectangle(WIDTH / 10, HEIGHT / 10);
    rgTT.setX(rgTL.getWidth() / 2 - rgTT.getWidth() / 2);
    rgTT.setY(rgTL.getHeight());
    rgTT.setFill(Color.web("bfbfbf"));
    gToilet.getChildren().add(rgTT);
    
    Polygon rgTB = new Polygon();
    rgTB.getPoints().addAll(new Double[] {
        rgTL.getWidth() * 0.05, rgTT.getY() + rgTT.getHeight(),
        rgTL.getWidth() * 0.95, rgTT.getY() + rgTT.getHeight(),
        rgTL.getWidth() * 0.85, rgTT.getY() + rgTT.getHeight() + rgTL.getHeight() * 3,
        rgTL.getWidth() * 0.15, rgTT.getY() + rgTT.getHeight() + rgTL.getHeight() * 3,
    });
    rgTB.setFill(Color.web("bfbfbf"));
    gToilet.getChildren().add(rgTB);
    
    Rectangle rgTS = new Rectangle(rgTL.getWidth() / 2, rgTL.getHeight() * 2);
    rgTS.setX(rgTL.getWidth() / 2 - rgTS.getWidth() / 2);
    rgTS.setY(rgTB.getBoundsInParent().getMaxY());
    rgTS.setFill(Color.web("bfbfbf"));
    gToilet.getChildren().add(rgTS);
    
    // Position toilet
    gToilet.setTranslateX(WIDTH / 4);
    gToilet.setTranslateY(HEIGHT - gToilet.getBoundsInParent().getHeight());
    this.getChildren().add(gToilet);
    
    // Draw sink
    HBox hbSinkHandles = new HBox(WIDTH / (WIDTH / 4));
    gSink.getChildren().add(hbSinkHandles);
    
    Rectangle rgSHL = new Rectangle(WIDTH / (WIDTH / 4), HEIGHT / (HEIGHT / 8));
    rgSHL.setFill(Color.web("7f7f7f"));
    rgSHL.setTranslateY(2);
    hbSinkHandles.getChildren().add(rgSHL);
    
    Rectangle rgSHM = new Rectangle(WIDTH / (WIDTH / 4), HEIGHT / (HEIGHT / 12));
    rgSHM.setFill(Color.web("7f7f7f"));
    hbSinkHandles.getChildren().add(rgSHM);
    
    Rectangle rgSHR = new Rectangle(WIDTH / (WIDTH / 4), HEIGHT / (HEIGHT / 8));
    rgSHR.setFill(Color.web("7f7f7f"));
    rgSHR.setTranslateY(2);
    hbSinkHandles.getChildren().add(rgSHR);
    
    Rectangle rgST = new Rectangle(WIDTH / 8, (HEIGHT / (HEIGHT / 8)));
    rgST.setFill(Color.web("a5a5a5"));
    gSink.getChildren().add(rgST);
    
    Rectangle rgSS = new Rectangle(rgST.getWidth() / 2, rgST.getHeight() * 4);
    rgSS.setX(rgST.getWidth() / 2 - rgSS.getWidth() / 2);
    rgSS.setY(rgST.getY() + rgST.getHeight());
    rgSS.setFill(Color.web("bfbfbf"));
    gSink.getChildren().add(rgSS);
    
    // Position sink
    hbSinkHandles.setTranslateX(gSink.getBoundsInParent().getWidth() / 2 - (hbSinkHandles.getSpacing() * 5) / 2);
    hbSinkHandles.setTranslateY(-HEIGHT / (HEIGHT / 8));
    gSink.setTranslateX(WIDTH / 4 + gToilet.getBoundsInParent().getWidth() + (gSink.getBoundsInParent().getWidth() / 2));
    gSink.setTranslateY(HEIGHT - gSink.getBoundsInParent().getHeight() - hbSinkHandles.getTranslateY());
    this.getChildren().add(gSink);
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:69,代码来源:Room.java


注:本文中的javafx.scene.layout.HBox.setTranslateY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。