I'm using Netbeans to creat a Java Swing Gui form. I'm stuck creating output in an array that will print out in a text area box.
double tutorArray [] [] = new double [4][2]; int counter; int i = 0; int j = 0;
The user inputs two values at a time and then presses the enter button:
double salary = Double.parseDouble (salaryTextField.getText ()); double week = Double.parseDouble (wagesTextField.getText ()); try { {if (minutes <= 0 || minutes > 4500|| wages <= 4) throw new IllegalArgumentException (); } } catch (IllegalArgumentException exception) { dataTextArea.setText("Invalid input. Please try again."); return; } dataTextArea.setText(""); tutorArray [counter] [0] = salary; tutorArray [counter] [1] = weeks; counter++; for (int i = 0; i <= 4 ; i++){ for (int j = 0; j <= 2; j++) { String line = String.format ("%2d", tutorArray[i][j]); dataTextArea.append (line); counter++; } }
3. Once the user finishes entering his information, a 2d Array should be generated when he presses the "run report" button:
private void runReportButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: }
I have tried multiple times to write the code for a 2d array that has 4 rows and two columns containing the information entered by the users - minutes and wages.
Any pointers?