title: Adding user input to array
body: <p>Got a program that takes user input from JTextFeld and adds them to a JTextArea. Here's the action listener class:</p>
  
  <pre><code>/**
   * Action listener class for reading in data and processing it
   * when the Add reading button is clicked.
   */
  class AddReadingListener implements ActionListener
  {
      public void actionPerformed(ActionEvent event)
      {
          // Fetch the new reading details
  
              int newDay = Integer.parseInt(dayEntryField.getText());
              double newRain = Double.parseDouble(rainEntryField.getText());
  
              // Clear the input
              dayEntryField.setText("");
              rainEntryField.setText("");
              dataArea.append(newDay + ": " + newRain + " cm" + "\n");
          }
      }
  }
  </code></pre>
  
  <p>I've created an array to store the user input, however I don't know how to store the values from the JLabel into the array? I assume its something that needs to be implemented in the action listener class when the button is pressed?</p>
  
  <pre><code>public void getRain()
  {
      double[] rArray = new double[32];
      for(int c = 0;c&lt;rArray.length;c++)
      {
          rArray[1] = Integer.parseInt(""+dayEntryField);
      }
  }
  </code></pre>
  
  <p>Doubt the array is correct, but any help would be appreciated!</p>