0

I am building an application window and it has several textFields. All JTextFields will have user input, however on most occasions they might not need to input figures into all the boxes (will depend on a combo box how many boxes need to be filled). Each text box has variable Prob1, Prob2 etc. There are 9 currently but could continue to grow.

I'd like to know if there is any way I can, without calling each Prob1 etc, loop my variables to get stored into an array.

As there will be an ever changing number of events, looping it will be so much easier down the track. The # of events drop down will set the length of the array.

So some psuedo code would look like this:

loop function (i = 0, i i < #events, i++) {

    probabilities[i] = Integer.parseInt(Prob(i+1).getText);
}

I need it to somehow move onto the next JTextField box when the loop gets passed through again.

Frakcool
  • 10,088
  • 9
  • 41
  • 71

0 Answers0