title: How to transfer input data from a private void GUI to an ArrayList in a java class?
body: <p>I need help with a specific problem in my class project. The goal of the project is to create a program in which you can register how much shares you own. Information that's required is the company name, how many shares you own and their respective value. I created a GUI class and a class where the information is transferred to. The input comes from a private void. I'm having trouble finding a way to transfer the input from the private void to a an arraylist in a class outside it.</p>
  
  <p>Here is how I initialized the arraylist in the GUI class.</p>
  
  <pre><code>public class GUISharePortfolio_1 extends javax.swing.JFrame {
  
  ArrayList&lt;SharePackage.Share&gt; Package = new ArrayList&lt;SharePackage.Share&gt;();
  </code></pre>
  
  <p>Next is how I get the company name, number of shares and their value from the GUI. Since it is a private void I have to transfer that information to the SharePackage class.</p>
  
  <pre><code>private void CreatePortfolioButtonActionPerformed(java.awt.event.ActionEvent evt) {
  
      String name;
      double number;
      double value;
  
      name = CompanyNameField.getText();
      number = Double.parseDouble(NumberOfSharesField.getText());
      value = Double.parseDouble(ValueOfShareField.getText());
  
      Package.CompanyName(name);
      Package.NumberOfShares(number);
      Package.ValueOfShare(value);
  
  }
  </code></pre>
  
  <p>I'm getting an error saying "cannot find symbol" under the CompanyName, NumberOfShares and ValueOfShare.</p>
  
  <p>The public class to which the info should be transferred is this:</p>
  
  <pre><code>    package shareportfolio;
  
  import java.util.ArrayList;
  
  public class SharePackage
  {
      private ArrayList&lt;Share&gt; Package = new ArrayList&lt;Share&gt;();
  
  public class Share
  {
      private String companyname;
      private double numberofshares;
      private double valueofshare;
  
      Share(String companyname, double numberofshares, double valueofshare)
      {
          this.companyname = companyname;
          this.numberofshares = numberofshares;
          this.valueofshare = valueofshare;
      }
  
      public void setCompanyName(String name)
      {
          companyname = name;
      }
  
      public String getCompanyName()
      {
          return(companyname);
      }
  
      public void setNumberOfShares(double number)
      {
          numberofshares = number;
      }
  
      public double getNumberOfShares()
      {
          return(numberofshares);
      }
  
      public void setValueOfShare(double value)
      {
          valueofshare = value;
      }
  
      public double getValueOfShare()
      {
          return(valueofshare);
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I would appreciate any help very much.</p>