Near the top I run that test line that prints out the array data. It comes back as all 0s.
I don't understand why the array data didn't carry over.
Should I just do the calculations for the totals in the Enter button code since the values are there?

Re: Losing data from array - not sure why

You look to be completely re-creating the array each time actionPerformed is called, and so it makes sense that nothing held previously is saved. You do appear to be incrementing the row variable, but don't appear to be using it anywhere. Shouldn't this be used as the array row index for the newly added data?

If you're dead set on using an array, then consider creating an array of adequately large size on object creation, perhaps in the constructor, and then only adding data to it, using the row variable, inside of the actionPerformed method. Alternatively, you could package your two data points in their own object that you've created and then add them to an ArrayList in the actionPerformed method. If you go this route, then again the ArrayList needs to be created on object creation, not inside of the actionPerformed method.

Re: Losing data from array - not sure why

So since recreating the array is the problem, all the calculations need to be done under the Enter button, I assume.

I had a feeling that the way I declared the array was a problem. All the books I have use a different style. I guess that means rethinking things a bit but it may help me because all the calculation examples I've been seeing use the regular type of declaration. It's got to be done in a 2D array. I've actually got the program working with no array (and it works perfectly), but that won't cut it.

I came up with this, doesn't work (yet) but it may be closer to what I need. This is the enter button code -

Re: Losing data from array - not sure why

Use a variation of he latter, something like:

Java Code:

double[][] userInput = new double[MAX_ROWS][COLUMNS];

Where MAX_ROWS is a constant that should be adequate for all the rows your app will need, and COLUMNS is an int constant, 2. Don't declare this in the event handler but as a field of the class. If this were my app though, I'd create a class with two fields, one for minutesIn and one for paymentIn, and then I'd create an ArrayList of objects of this class rather than messing with partially filled arrays.

Re: Losing data from array - not sure why

Allrighty.

Now the output from the console looks normal in format but it's 0.0 0.0
I'm missing something here. The values have been parsed and I thought that was enough to get them in to the array but they're not making it.

Maybe -

Java Code:

data.add(minutesIn, paymentIn);

But something needs to be imported for data (cannot find symbol error), can't find out what though.