是否可以在JavaFX2子列表中更改节点的顺序?我试着set()和Collections.swap()但都扔IllegalArgumentException在Parent在某一时刻,孩子列表包含同一项目在两个位置(当节点是在新的位置,并没有被从老位置删除).父内部有一些标志,JavaFX在内部使用toFront()并且toBack()可以防止异常,但是无法从外部访问它们.
java.lang.IllegalArgumentException: Children: duplicate children added: parent = HBox@1424bf0
at javafx.scene.Parent$1.onProposedChange(Parent.java:307)
at com.sun.javafx.collections.VetoableObservableList.set(VetoableObservableList.java:156)
at com.sun.javafx.collections.ObservableListWrapper.set(ObservableListWrapper.java:281)
at java.util.Collections.swap(Collections.java:532)
Run Code Online (Sandbox Code Playgroud) 我正在使用StackPanel作为我的图形,面板等的容器.我发现,坐标X,Y(0,0)位于我面板的中心.
有可能将它移到左上方的窗格吗?从中心计算所有尺寸要困难得多.