本文整理匯總了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;
}
}
示例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);
}