Mike Chilton

Greenhorn
+ Follow
since Jun 18, 2012
Mike likes ...
Eclipse IDE Java
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Chilton

Sorry, I wasn't asking for help with design decisions--just how to code row and column totals and put the results into a column and row.
10 years ago
I'm trying to create row and column totals in a jTable. The user can input cell values using 3 text fields (to identify the row, column & value) and a button to add it to the table. The user should then be able to click on a second button which will sum all columns and rows and display the column sums in the last row and the row sums in the last column. Unfortunately I receive an error "NullPointerException" and the program breaks at line 135: salesTotal[row] += Double.valueOf(value).doubleValue();

I am under the impression that the cell values are objects and must be converted to (first) Strings and (second) doubles before you can total them, but not sure how to do this. The program breaks before it can set the value in the appropriate cell, so I haven't been able to test that part yet.

Here is the code.
10 years ago