I have a java GUI that contains 2 text boxes and 2 buttons. When the enter button is pushed it needs to store the values in the text boxes in a 2D array and clear the text boxes. When the report button is pushed it needs to output all values in the 2D array to a text area. Below is the code that I have so far. It appears that it is not adding all the values to the rows as it loops and I would like to know how to ouput all values in the array to a textarea. Any help would be greatly appreciated. Thank You
public class TutoringSessionUI extends javax.swing.JFrame { double [][] tutorArray = new double[1][2]; private void EnterButtonActionPerformed(java.awt.event.ActionEvent evt) { for(int j = 0; j < tutorArray.length; j++){ for(int k = 0; k < tutorArray.length; k++){ //double minutesInt = 0; //double moneyInt = 0; double minutesInt = Double.parseDouble(TimeText.getText()); double moneyInt= Double.parseDouble(MoneyText.getText()); if (minutesInt < 0) { IllegalArgumentException exception = new IllegalArgumentException("Invalid payment amount."); throw exception; } //Checks for negative numbers in Money and throws exception if found. if (moneyInt < 0) { IllegalArgumentException exception = new IllegalArgumentException("Invalid time amount."); throw exception; } tutorArray[j][0] = minutesInt; tutorArray[j][1] = moneyInt; System.out.println(tutorArray[j][0]); System.out.println(tutorArray[j][1]); System.out.println(); TimeText.setText(""); MoneyText.setText(""); } } } private void QuitButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: System.exit(0); } private void ReportButtonActionPerformed(java.awt.event.ActionEvent evt) { double tutorOutput = tutorArray[0][0] + tutorArray[0][1]; String tutorOutPut = Double.toString(tutorOutput); ReportArea.append(tutorOutPut); }