Clone JavaFX Node?

前端 未结 2 835
悲哀的现实
悲哀的现实 2020-12-20 12:27

I have created a Node (AnchorPane) in the JavaFX scene builder and was wondering how to clone it.

I saw Duplicate/Clone Node in JavaFX 2.0

2条回答
  •  旧巷少年郎
    2020-12-20 13:01

    You can place the component that needs to be duplicated in a separate .fxml file.

    Then you can load the separate file as many times as needed adding the nodes to the appropriate root in the main scene.

    Additionally you can edit an element to the main .fxml file and include the separate .fxml file. You can then still work with it in the JavaFX Builder.

提交回复
热议问题