title: Java variable cannot be resolved or is not a field
body: <p>I'm getting a "Cannot be resolved or is not a field" error on a variable in one of my Java classes, and I don't understand why... I've had a look online, but can't find anything that really explains why I'm getting it. The error is happening in the following <code>for</code> loop:</p>
  
  <pre><code>int i;
  getFilterConditions();
  for(i = 0; i &lt; sitesToBeFiltered.size(); i++){
      if(sitesToBeFiltered.get(i) == filter1Value){
          Gui.displayFilteredOutput.append("\n");
      Gui.displayFilteredOutput.append("EID: [" + sitesToBeFiltered.get(i) + ", " + applicationsToBeFiltered.get(i) + ", " + IDsToBeFiltered.get(i) + "]. ");
      Vector3Double filteredEntityPosition = 
      Gui.displayFilteredOutput.append("Location in DIS coordinates: [" + sitesToBeFiltered.get(i).positionsToBeFilteredX.get(i));
      }
  }
  </code></pre>
  
  <p>It's being generated on the <code>positionsToBeFilteredX.get(i)</code> variable at the end of the <code>for</code> loop. I have defined that variable as a global variable at the top of the class using the line:</p>
  
  <pre><code>public static ArrayList&lt;Double&gt; positionsToBeFilteredX = new ArrayList&lt;Double&gt;();
  </code></pre>
  
  <p>To explain what I'm trying to do here:</p>
  
  <p>I have a program that is reading the PDUs that are being sent/ received over a network, and storing both the PDUs themselves, and information held by each of the PDUs in a number of ArrayLists. What I'm trying to do with this code, is to take a value entered by the user on a form (stored in the <code>filter1Value</code> integer variable), and check whether that value is equal to any of the elements in a particular ArrayList (<code>sitesToBeFiltered</code>).</p>
  
  <p>So, I am looping through the <code>sitesToBeFiltered</code> ArrayList, and checking every element to see whether it is exactly equal to the value of <code>filter1Value</code>. If it is, I am then appending some text about the matching ArrayList element to a JTextArea (<code>displayFilteredOutput</code>).</p>
  
  <p>One of the things I want to add to the JTextArea is the X position of the matching element (which was added to the <code>positionsToBeFilteredX</code> when it was found that that the element matched the user's search criteria.</p>
  
  <p>So what I'm trying to do with the last line of code is to append the X coordinate (stored in an array of X coordinates) of the matching element in the <code>sitesToBeFiltered</code> ArrayList, to the <code>displayFilteredOutput</code> JTextArea, but for some reason, I'm getting this "cannot be resolved, or is not a field" compile error on the variable.</p>
  
  <p>Can anyone explain to me why this is? I suspect that I am not referencing the X coordinate of the element matching the filter value correctly, but I'm not sure how I should be doing this... Could someone point me in the right direction?</p>