Reputation: 89
I want to add dynamically labels to a pane :
for (int k = 0; k < traitement.quad.lqua.size(); k++)
{
Label l = new Label();
l.setText(traitement.quad.lqua.get(k));
apane.getChildren().add(l);
}
i don't want to have them in the same place i want to have one label by ligne , so where is the issue ?
Upvotes: 0
Views: 2394
Reputation: 7526
Replace the AnchorPane
with a VBox
. That way all the labels will be added one below another.
AnchorPane
manages the layouting of the children according to the anchor, which in your case seems to be top left. This works well if there is only one child, but will result in a mess if there are more.
In my personal experience I find AnchorPane
not very useful when it comes to designing complex user interface. I usually en up using a Group
or Pane
instead and handle the layouting myself.
Upvotes: 1