0
添加节点(PROGRAMM)如果我追加像这样的节点:的JavaFX之前或之后的另一个节点(XML)
HBox child = new HBox();
HBox fooBar = (HBox) doc.lookup("#fooBar");
fooBar.getChildren().add(child);
它可能工作,但不是我想要它,因为我想要定义的位置的方式。如果我在fooBar之前或之后想要孩子怎么办?
<HBox>
<HBox id="first"></HBox>
<HBox id="fooBar"></HBox>
<HBox id="last"></HBox>
</HBox>
当然,'fooBar.getChildren()的indexOf(FOOBAR)'必定返回'-1',因为你不允许添加一个节点作为自身的一个孩子 - 但更多的是这个问题的问题比答案的问题。 –
你说得对。当然它必须是父母 – Abaddon666
谢谢!太棒了。 – Asperger