JavaFX issue when placing square at coordinates

后端 未结 1 901
情深已故
情深已故 2021-01-26 13:35

so i have the following code from a Rectangle

rect.setX(10);

and I also have

rect.setY(20);

but whenever i co

1条回答
  •  礼貌的吻别
    2021-01-26 14:06

    Considering that the rectangle is added to a StackPane, you must use the translate properties to move the rectangle. Try :

    rect.setTranslateX(10);
    rect.setTranslateY(20);
    

    0 讨论(0)
提交回复
热议问题