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


Java VBox.setTranslateX方法代码示例

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


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

示例1: createVerticalBox

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

示例2: doorClosed

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void doorClosed() {
    // Draw trim
    Rectangle rgDT = new Rectangle(WIDTH, HEIGHT);
    rgDT.setFill(Color.web("4d2626"));
    this.getChildren().add(rgDT);

    // Draw door
    Rectangle rgDD = new Rectangle(WIDTH - (WIDTH / (WIDTH / 4)), HEIGHT - (HEIGHT / (HEIGHT / 2)));
    rgDD.setTranslateX((WIDTH / (WIDTH / 2)));
    rgDD.setTranslateY((HEIGHT / (HEIGHT / 2)));
    rgDD.setFill(Color.web("673232"));
    this.getChildren().add(rgDD);

    // Draw three hinges
    VBox vbHinges = new VBox(WIDTH / 3);
    Rectangle rgDH1 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH1.setFill(Color.web("a5a5a5"));
    Rectangle rgDH2 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH2.setFill(Color.web("a5a5a5"));
    Rectangle rgDH3 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH3.setFill(Color.web("a5a5a5"));
    vbHinges.getChildren().addAll(rgDH1, rgDH2, rgDH3);
    vbHinges.setTranslateX(rgDH1.getWidth() / 2);
    vbHinges.setTranslateY(rgDH1.getHeight());
    this.getChildren().add(vbHinges);

    // Draw door handle block
    Rectangle rgDHM = new Rectangle((WIDTH / (WIDTH / 4)), (WIDTH / (WIDTH / 4)));
    rgDHM.setTranslateX(WIDTH - rgDHM.getWidth() * 2);
    rgDHM.setTranslateY(HEIGHT / 2 - rgDHM.getHeight() / 2);
    rgDHM.setFill(Color.web("bfbfbf"));
    this.getChildren().add(rgDHM);

    // Draw door handle
    Rectangle rgDHL = new Rectangle((WIDTH / (WIDTH / 8)), (WIDTH / (WIDTH / 2)));
    rgDHL.setTranslateX(WIDTH - rgDHL.getWidth() * 2);
    rgDHL.setTranslateY(HEIGHT / 2 - rgDHL.getHeight() / 2);
    rgDHL.setFill(Color.web("a5a5a5"));
    this.getChildren().add(rgDHL);
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:41,代码来源:Door.java

示例3: doorOpen

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void doorOpen() {
    // Draw trim
    Rectangle rgDT = new Rectangle(WIDTH, HEIGHT);
    rgDT.setFill(Color.TRANSPARENT);
    rgDT.setStroke(Color.web("4d2626"));
    rgDT.setStrokeWidth((WIDTH / (WIDTH / 2)));
    this.getChildren().add(rgDT);

    // Draw three hinges
    VBox vbHinges = new VBox(WIDTH / 3);
    Rectangle rgDH1 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH1.setFill(Color.web("a5a5a5"));
    Rectangle rgDH2 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH2.setFill(Color.web("a5a5a5"));
    Rectangle rgDH3 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH3.setFill(Color.web("a5a5a5"));
    vbHinges.getChildren().addAll(rgDH1, rgDH2, rgDH3);
    vbHinges.setTranslateX(rgDH1.getWidth() / 2);
    vbHinges.setTranslateY(rgDH1.getHeight());
    this.getChildren().add(vbHinges);

    // Draw door
    Rectangle rgDD = new Rectangle(WIDTH - (WIDTH / (WIDTH / 4)), HEIGHT);
    rgDD.setTranslateX((WIDTH / (WIDTH / 2)) - rgDD.getWidth());
    rgDD.setTranslateY((HEIGHT / (HEIGHT / 2)) / 2);
    rgDD.setFill(Color.web("673232"));
    this.getChildren().add(rgDD);
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:29,代码来源:Door.java

示例4: doorClosed

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void doorClosed() {
    // Draw trim
    Rectangle rgDT = new Rectangle(WIDTH, HEIGHT);
    rgDT.setFill(Color.web("4d2626"));
    this.getChildren().add(rgDT);
    
    // Draw door
    Rectangle rgDD = new Rectangle(WIDTH - (WIDTH / (WIDTH / 4)) , HEIGHT - (HEIGHT / (HEIGHT / 2)));
    rgDD.setTranslateX((WIDTH / (WIDTH / 2)));
    rgDD.setTranslateY((HEIGHT / (HEIGHT / 2)));
    rgDD.setFill(Color.web("673232"));
    this.getChildren().add(rgDD);
    
    // Draw three hinges
    VBox vbHinges = new VBox(WIDTH / 3);
    Rectangle rgDH1 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH1.setFill(Color.web("a5a5a5"));
    Rectangle rgDH2 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH2.setFill(Color.web("a5a5a5"));
    Rectangle rgDH3 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH3.setFill(Color.web("a5a5a5"));
    vbHinges.getChildren().addAll(rgDH1, rgDH2, rgDH3);
    vbHinges.setTranslateX(rgDH1.getWidth() / 2);
    vbHinges.setTranslateY(rgDH1.getHeight());
    this.getChildren().add(vbHinges);
    
    // Draw door handle block
    Rectangle rgDHM = new Rectangle((WIDTH / (WIDTH / 4)), (WIDTH / (WIDTH / 4)));
    rgDHM.setTranslateX(WIDTH - rgDHM.getWidth() * 2);
    rgDHM.setTranslateY(HEIGHT / 2 - rgDHM.getHeight() / 2);
    rgDHM.setFill(Color.web("bfbfbf"));
    this.getChildren().add(rgDHM);
    
    // Draw door handle
    Rectangle rgDHL = new Rectangle((WIDTH / (WIDTH / 8)), (WIDTH / (WIDTH / 2)));
    rgDHL.setTranslateX(WIDTH - rgDHL.getWidth() * 2);
    rgDHL.setTranslateY(HEIGHT / 2 - rgDHL.getHeight() / 2);
    rgDHL.setFill(Color.web("a5a5a5"));
    this.getChildren().add(rgDHL);
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:41,代码来源:Door.java

示例5: doorOpen

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void doorOpen() {
    // Draw trim
    Rectangle rgDT = new Rectangle(WIDTH, HEIGHT);
    rgDT.setFill(Color.TRANSPARENT);
    rgDT.setStroke(Color.web("4d2626"));
    rgDT.setStrokeWidth((WIDTH / (WIDTH / 2)));
    this.getChildren().add(rgDT);
    
    // Draw three hinges
    VBox vbHinges = new VBox(WIDTH / 3);
    Rectangle rgDH1 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH1.setFill(Color.web("a5a5a5"));
    Rectangle rgDH2 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH2.setFill(Color.web("a5a5a5"));
    Rectangle rgDH3 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH3.setFill(Color.web("a5a5a5"));
    vbHinges.getChildren().addAll(rgDH1, rgDH2, rgDH3);
    vbHinges.setTranslateX(rgDH1.getWidth() / 2);
    vbHinges.setTranslateY(rgDH1.getHeight());
    this.getChildren().add(vbHinges);
    
    // Draw door
    Rectangle rgDD = new Rectangle(WIDTH - (WIDTH / (WIDTH / 4)) , HEIGHT);
    rgDD.setTranslateX((WIDTH / (WIDTH / 2)) - rgDD.getWidth());
    rgDD.setTranslateY((HEIGHT / (HEIGHT / 2)) / 2);
    rgDD.setFill(Color.web("673232"));
    this.getChildren().add(rgDD);
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:29,代码来源:Door.java

示例6: initBoxes

import javafx.scene.layout.VBox; //导入方法依赖的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

示例7: doorHalf

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void doorHalf() {
    // Draw trim
    Rectangle rgDT = new Rectangle(WIDTH, HEIGHT);
    rgDT.setFill(Color.TRANSPARENT);
    rgDT.setStroke(Color.web("4d2626"));
    rgDT.setStrokeWidth((WIDTH / (WIDTH / 2)));
    this.getChildren().add(rgDT);

    // Draw three hinges
    VBox vbHinges = new VBox(WIDTH / 3);
    Rectangle rgDH1 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH1.setFill(Color.web("a5a5a5"));
    Rectangle rgDH2 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH2.setFill(Color.web("a5a5a5"));
    Rectangle rgDH3 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH3.setFill(Color.web("a5a5a5"));
    vbHinges.getChildren().addAll(rgDH1, rgDH2, rgDH3);
    vbHinges.setTranslateX(rgDH1.getWidth() / 2);
    vbHinges.setTranslateY(rgDH1.getHeight());
    this.getChildren().add(vbHinges);

    // Draw door
    Rectangle rgDD = new Rectangle((WIDTH / (WIDTH / 2)), HEIGHT);
    rgDD.setTranslateX((WIDTH / (WIDTH / 2)) - rgDD.getWidth());
    rgDD.setTranslateY((HEIGHT / (HEIGHT / 2)) / 2);
    rgDD.setFill(Color.web("673232"));
    this.getChildren().add(rgDD);

    // Draw door handle block
    Rectangle rgDHM = new Rectangle((WIDTH / (WIDTH / 2)), (WIDTH / (WIDTH / 4)));
    rgDHM.setTranslateX(rgDD.getX() - rgDD.getWidth());
    rgDHM.setTranslateY(rgDD.getY() + rgDD.getHeight() / 2 - rgDHM.getHeight() / 2);
    rgDHM.setFill(Color.web("bfbfbf"));
    this.getChildren().add(rgDHM);

    // Draw door handle
    Rectangle rgDHL = new Rectangle((WIDTH / (WIDTH / 2)), (WIDTH / (WIDTH / 2)));
    rgDHL.setTranslateX(rgDD.getX() - rgDHL.getWidth() - rgDD.getWidth());
    rgDHL.setTranslateY(rgDD.getY() + rgDD.getHeight() / 2 - rgDHL.getHeight() / 2);
    rgDHL.setFill(Color.web("a5a5a5"));
    this.getChildren().add(rgDHL);
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:43,代码来源:Door.java

示例8: displayGameButtons

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void displayGameButtons(boolean display) {
    // Button width
    double btnWidth = WIDTH / 5;
    double btnHeight = HEIGHT / 10;
    if (display == true) { // Display logo
        // VBox for new and load game
        gameButtons = new VBox(WIDTH / 50);
        gameButtons.setTranslateX((WIDTH / 2) - btnWidth / 2);
        gameButtons.setTranslateY((HEIGHT / 2) - btnHeight);

        // Import a image for new game button
        //ImageView ivNewGame = new ImageView(new Image("images\\TitleScreen\\"
        //        + "imgNewGame.png"));
        //ivNewGame.setFitWidth(WIDTH / 5);
        //ivNewGame.setFitHeight(HEIGHT / 10);
        // Import a image for load game button
        //ImageView ivLoadGame = new ImageView(new Image("images\\TitleScreen\\"
        //        + "imgLoadGame.png"));
        //ivLoadGame.setFitWidth(WIDTH / 5);
        //ivLoadGame.setFitHeight(HEIGHT / 10);
        // Customise btnGameNew
        btnGameNew.setMinSize(btnWidth, btnHeight);
        btnGameNew.setPrefSize(btnWidth, btnHeight);
        btnGameNew.setMaxSize(btnWidth, btnHeight);
        btnGameNew.setText("NEW GAME");
        //btnGameNew.setGraphic(ivNewGame);
        btnGameNew.setStyle("-fx-background-color: #eaeaea; ");

        // Customise btnGameLoad
        btnGameLoad.setMinSize(btnWidth, btnHeight);
        btnGameLoad.setPrefSize(btnWidth, btnHeight);
        btnGameLoad.setMaxSize(btnWidth, btnHeight);
        btnGameLoad.setText("LOAD GAME");
        //btnGameLoad.setGraphic(ivLoadGame);
        btnGameLoad.setStyle("-fx-background-color: #eaeaea; ");

        // Add buttons to vbox
        gameButtons.getChildren().addAll(btnGameNew, btnGameLoad);

        // Add vbox to pane
        getChildren().add(gameButtons);
    } else if (display == false) { // Do not display
        getChildren().remove(gameButtons);
    }
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:46,代码来源:TitleScreen.java

示例9: doorHalf

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void doorHalf() {
    // Draw trim
    Rectangle rgDT = new Rectangle(WIDTH, HEIGHT);
    rgDT.setFill(Color.TRANSPARENT);
    rgDT.setStroke(Color.web("4d2626"));
    rgDT.setStrokeWidth((WIDTH / (WIDTH / 2)));
    this.getChildren().add(rgDT);
    
    // Draw three hinges
    VBox vbHinges = new VBox(WIDTH / 3);
    Rectangle rgDH1 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH1.setFill(Color.web("a5a5a5"));
    Rectangle rgDH2 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH2.setFill(Color.web("a5a5a5"));
    Rectangle rgDH3 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH3.setFill(Color.web("a5a5a5"));
    vbHinges.getChildren().addAll(rgDH1, rgDH2, rgDH3);
    vbHinges.setTranslateX(rgDH1.getWidth() / 2);
    vbHinges.setTranslateY(rgDH1.getHeight());
    this.getChildren().add(vbHinges);
    
    // Draw door
    Rectangle rgDD = new Rectangle((WIDTH / (WIDTH / 2)) , HEIGHT);
    rgDD.setTranslateX((WIDTH / (WIDTH / 2)) - rgDD.getWidth());
    rgDD.setTranslateY((HEIGHT / (HEIGHT / 2)) / 2);
    rgDD.setFill(Color.web("673232"));
    this.getChildren().add(rgDD);
    
    // Draw door handle block
    Rectangle rgDHM = new Rectangle((WIDTH / (WIDTH / 2)), (WIDTH / (WIDTH / 4)));
    rgDHM.setTranslateX(rgDD.getX() - rgDD.getWidth());
    rgDHM.setTranslateY(rgDD.getY() + rgDD.getHeight() / 2 - rgDHM.getHeight() / 2);
    rgDHM.setFill(Color.web("bfbfbf"));
    this.getChildren().add(rgDHM);
    
    // Draw door handle
    Rectangle rgDHL = new Rectangle((WIDTH / (WIDTH / 2)), (WIDTH / (WIDTH / 2)));
    rgDHL.setTranslateX(rgDD.getX() - rgDHL.getWidth() - rgDD.getWidth());
    rgDHL.setTranslateY(rgDD.getY() + rgDD.getHeight() / 2 - rgDHL.getHeight() / 2);
    rgDHL.setFill(Color.web("a5a5a5"));
    this.getChildren().add(rgDHL);
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:43,代码来源:Door.java

示例10: start

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	loadData();
	tree = new J48();
	tree.buildClassifier(data);

	noClassificationChart = buildChart("No Classification (click to add new data)", buildSingleSeries());
	clusteredChart = buildChart("Clustered", buildClusteredSeries());
	realDataChart = buildChart("Real Data (+ Decision Tree classification for new data)", buildLabeledSeries());

	noClassificationChart.setOnMouseClicked(e -> {
		Axis<Number> xAxis = noClassificationChart.getXAxis();
		Axis<Number> yAxis = noClassificationChart.getYAxis();
		Point2D mouseSceneCoords = new Point2D(e.getSceneX(), e.getSceneY());
		double x = xAxis.sceneToLocal(mouseSceneCoords).getX();
		double y = yAxis.sceneToLocal(mouseSceneCoords).getY();
		Number xValue = xAxis.getValueForDisplay(x);
		Number yValue = yAxis.getValueForDisplay(y);
		reloadSeries(xValue, yValue);
	});

	Label lblDecisionTreeTitle = new Label("Decision Tree generated for the Iris dataset:");
	Text txtTree = new Text(tree.toString());
	String graph = tree.graph();
	SwingNode sw = new SwingNode();
	SwingUtilities.invokeLater(() -> {
		TreeVisualizer treeVisualizer = new TreeVisualizer(null, graph, new PlaceNode2());
		treeVisualizer.setPreferredSize(new Dimension(600, 500));
		sw.setContent(treeVisualizer);
	});

	Button btnRestore = new Button("Restore original data");
	Button btnSwapColors = new Button("Swap clustered chart colors");
	StackPane spTree = new StackPane(sw);
	spTree.setPrefWidth(300);
	spTree.setPrefHeight(350);
	VBox vbDecisionTree = new VBox(5, lblDecisionTreeTitle, new Separator(), spTree,
			new HBox(10, btnRestore, btnSwapColors));
	btnRestore.setOnAction(e -> {
		loadData();
		reloadSeries();
	});
	btnSwapColors.setOnAction(e -> swapClusteredChartSeriesColors());
	lblDecisionTreeTitle.setTextFill(Color.DARKRED);
	lblDecisionTreeTitle.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, 16));
	txtTree.setTranslateX(100);
	txtTree.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, 14));
	txtTree.setLineSpacing(1);
	txtTree.setTextAlignment(TextAlignment.LEFT);
	vbDecisionTree.setTranslateY(20);
	vbDecisionTree.setTranslateX(20);

	GridPane gpRoot = new GridPane();
	gpRoot.add(realDataChart, 0, 0);
	gpRoot.add(clusteredChart, 1, 0);
	gpRoot.add(noClassificationChart, 0, 1);
	gpRoot.add(vbDecisionTree, 1, 1);

	stage.setScene(new Scene(gpRoot));
	stage.setTitle("Íris dataset clustering and visualization");
	stage.show();
}
 
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:63,代码来源:Clustering.java


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