本文整理汇总了Java中javafx.scene.shape.Rectangle.setLayoutX方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.setLayoutX方法的具体用法?Java Rectangle.setLayoutX怎么用?Java Rectangle.setLayoutX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Rectangle
的用法示例。
在下文中一共展示了Rectangle.setLayoutX方法的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;
}
}
示例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();
}
}
示例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;
}
示例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);
}