I made an ImageView
array:
public static ImageView[] array = new ImageView[2];
Then set the ImageView
:
ImageView img = new ImageView(new Image("sample.png"));
array [0] = img;
array [1] = img;
Then add it to the screen:
root.getChildren().add(array [0]);
root.getChildren().add(array [1]);
ERROR:
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = BorderPane@78e30575
So, where is my mistake?