2 Replies Latest reply: May 24, 2012 9:24 AM by 800632 RSS

    Can't add second child to StackPane repeatedly

    800632
      Hi,

      I have a StackPane array, which is filled up with two ImageViews. First ImageView is an unique picture, second ImageView is the same for every StackPane:
             StackPane[] cards = new StackPane[gisView.length];
              for (int i = 0; i < cards.length; i++) {
                  cards[i] = new StackPane();
                  System.out.println(cards.getChildren().add(gisView[i]));
      System.out.println(cards[i].getChildren().add(topCard));
      System.out.println(cards[i].isManaged());
      System.out.println(cards[i].getChildren());
      }


      The problem is, that the second ImageView - topCard, is added only to first/last StackPane even I added it to every StackPane in cards.
      - both add() methods return true, as well as isManaged() method.
      - addAll(E...) doesn't work either even it returns true too.
      - I checked the errorProperty for every Image and there's no problem with loading the images.
      - both ImageViews do get added to StackPane inside the for loop, but there's only one ImageView in StackPane outside the for loop.

      I hope it's some trivial issue that I just can't spot.

      Edited by: user10869786 on May 24, 2012 6:10 AM