1 Reply Latest reply: Mar 17, 2013 8:24 PM by James_D RSS

    Array of Labels

    895675
      Is there any way to create an array of Label? Because I tried this way, but it did not work.
      ...
      Label Label[] = new Label[10];
      Label[0].setText("Label 1");
      Label[1].setText("Label 2");
      .....
      Thanks!

      Edited by: 892672 on 17/03/2013 18:08

      Edited by: 892672 on 17/03/2013 18:10

      Edited by: 892672 on 17/03/2013 18:10
        • 1. Re: Array of Labels
          James_D
          You need to create the individual Labels:
          Label[] labels = new Label[10];
          for (int i=0; i<labels.length; i++) {
            labels[i] = new Label();
            labels.setText("Label "+i);
          }