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


Java Rectangle.setLayoutY方法代码示例

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


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

示例1: addGroups

import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
private void addGroups() {
	int y = 5;
	int x = 5;
	for (int i = 0; i < 12; i++) {
		Rectangle temp = new Rectangle(146,194);
		temp.setArcHeight(15);
		temp.setArcWidth(15);
		String imageLocation = "/assets/card_assets/cards/backofHand.png";
		Image tempImage = new Image(imageLocation);
		temp.setFill(new ImagePattern(tempImage));
		temp.setStroke(Color.GRAY);
		temp.setVisible(true);
		temp.toFront();
		temp.setManaged(false);
		temp.setLayoutX(x);
		temp.setLayoutY(y);
		super.getChildren().add(temp);
		x-=1;
		y-=1;
	}
}
 
开发者ID:jarolrod,项目名称:java-solitaire,代码行数:22,代码来源:StockPile.java

示例2: setCanvasSize

import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
/**
 * 设置canvas大小
 */
private void setCanvasSize() {
    try {
        FXMLLoader fxmlLoader = new FXMLLoader((getClass().getResource("size_chooser.fxml")));
        Parent root1 = fxmlLoader.load();
        Stage stage = new Stage(DECORATED);
        stage.setTitle("选择画布");
        Scene scene = new Scene(root1);
        sizeChooser = fxmlLoader.getController();
        stage.setScene(scene);
        stage.showAndWait();
        if (sizeChooser.getCanvas() != null) {
            canvas.setHeight(sizeChooser.getCanvas().getHeight());
            canvas.setWidth(sizeChooser.getCanvas().getWidth());
            canvas.setLayoutX(450 - canvas.getWidth() / 2);
            canvas.setLayoutY(300 - canvas.getHeight() / 2);
            Rectangle rectangle = new Rectangle(canvas.getWidth(), canvas.getHeight());
            rectangle.setLayoutX(canvas.getLayoutX());
            rectangle.setLayoutY(canvas.getLayoutY());
            mainPane.setClip(rectangle);
            GraphicsContext gc = canvas.getGraphicsContext2D();
            gc.setFill(Color.WHITE);
            gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
        } else {
            //不选择就退出程序
            System.exit(0);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:xfangfang,项目名称:PhotoScript,代码行数:34,代码来源:Controller.java

示例3: createTic

import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
private Rectangle createTic(double angle, double width, double height) {
    Rectangle rectangle = new Rectangle(-width / 2, -height / 2, width, height);
    rectangle.setFill(Color.rgb(10, 10, 10));
    rectangle.setRotate(angle);
    rectangle.setLayoutX(radius * Math.cos(Math.toRadians(angle)));
    rectangle.setLayoutY(radius * Math.sin(Math.toRadians(angle)));
    return rectangle;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:StopWatch.java

示例4: NodePropertiesSample

import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public NodePropertiesSample() {
    super(300,100);
    //X position of node = X + LayoutX + TranslateX
    rectA = new Rectangle(50, 50, Color.LIGHTSALMON);
    //set position of node temporary (can be changed after)
    rectA.setTranslateX(10);

    rectB = new Rectangle(50, 50, Color.LIGHTGREEN);
    //set position of node when addinf to some layout
    rectB.setLayoutX(20);
    rectB.setLayoutY(10);

    rectC = new Rectangle(50, 50, Color.DODGERBLUE);
    //last posibility of setting X position of node
    rectC.setX(30);
    rectC.setY(20);

    //opacity of node can be set
    rectC.setOpacity(0.8);

    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Rectangle A translate X", rectA.translateXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Rectangle B translate X", rectB.translateXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Rectangle C translate X", rectC.translateXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Rectangle A Opacity", rectA.opacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Rectangle B Opacity", rectB.opacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Rectangle C Opacity", rectC.opacityProperty(), 0d, 1d)
            );

    getChildren().add(createRadioButtons());
    // END REMOVE ME

    Group g = new Group(rectA, rectB, rectC);
    g.setLayoutX(160 + 35);
    getChildren().addAll(g);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:38,代码来源:NodePropertiesSample.java


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