我有一个JavaFX 2.2 FlowPane,并希望它的孩子可以根据需要改变他们的订单.
我发现
Collections.sort( getChildren(), new Comparator(){...} );
Run Code Online (Sandbox Code Playgroud)
导致异常
java.lang.IllegalArgumentException: Children: duplicate children added: parent = ...
Run Code Online (Sandbox Code Playgroud)
I also tried to sort using the child Nodes toFront() method (as suggested here How to change order of children in JavaFX), but this does not seem to influence the list order.
Is there anything else I could try or are children in a scene graph unmutable regarding their order?