JavaFX: How to position a component/node?

后端 未结 3 1766
一个人的身影
一个人的身影 2021-01-13 06:29

In JavaFX, is there something similar to setLayout(); or setBounds();?

For example, I want to position a button to a position that I desir

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-13 06:56

    In addition to what others already mentioned, if you could place your button (or any node for that matter) inside a StackPane, then you could make use of the StackPane's alignment property that takes javafx.geometry.Pos (the alignment of the child within the StackPane). For example in your case:

    
        

提交回复
热议问题