title: Displaying from database issue
body: <p>I am doing an assignment in Eclipse Indigo with Java. I have to create a program for a school and that program is a spelling test program. I have been able to allow staff &amp; students to log on and also change their passwords and edit their accounts. I have also been able to create tests and also access them to edit. But one thing I cannot do is access the available tests in a list to see how many tests have been set. I don't know what to change in my code to fix this problem. <strong>To display the tests I have created a method called <em>displayTest</em></strong>. I have created storage for the tests using a <em>HashFile</em>. </p>
  
  <p>Here I have saved storage for the tests in a <em>HashFile</em>.</p>
  
  <pre><code>String test_FILENAME = "datafiles/test.dat";
  HashFile testFile = new HashFile(test_FILENAME, 100, new Test());
  </code></pre>
  
  <p>I have continued to add a test ( I have storage for the variable test at the top of my coding document) using:</p>
  
  <pre><code>public void addTest() {
     Test test = new Test();// create storage for a teacher
     test.input(); // read the teacher details in through the keyboard
     testFile.store(test); // store the teacher in the teacher file
  </code></pre>
  
  <p>I have also been able to edit the account (the PC etc. is from another class I use) using:</p>
  
  <pre><code>public void editTest() {
    String testNo;
    PC_Dialog editTests = new PC_Dialog("Edit Test", "Test No", "Find");// create a dialog box to ask for the teacher number
    editTests.choice();// display the dialog box
    testNo = editTests.getField(21); // get the teacherNo that has been entered
    test = (Test) testFile.retrieve(testNo); // retrieve the teacher from the file
    if (test != null) {// check if the teacher is found
       test.edit();// yes so display it for editing
       testFile.store(test); // store the teacher back in the teacher file
    } else
       JOptionPane.showMessageDialog(null, "Unable to find the test!");// not found so give an error message
  }// end of method
  </code></pre>
  
  <p>But in <strong>displayTest()</strong> I have some problems. The displayTest is meant to allow the teachers to view all the tests set to see which ones to edit and which ones remove at the click of a button. But the problem is that the <strong><em>if (test.year == year) {</em></strong> has a red line underneath the first <em>year</em> and when I hover over it, it says '<strong><em>year cannot be resolved or is not a field'</em></strong>. Can anyone help me try and make the displayTest section collect tests from the data file and display them on a table? I am new to Stackoverflow and have only used it once over a year ago. I apologize if anyone becomes frustrated looking at a newcomers work but this is practically like my first time using Stackoverflow. Help is much appreciated, thanks.</p>
  
  <p>I HAVE CHANGED THE CODE SINCE:</p>
  
  <pre><code>public void displayTest() {
    Test testNo = new Test();
    Test yearGroup = new Test();
    Test date = new Test();
    PC_Table table = new PC_Table("Tests Available", 0, "Test Number, Date, Year Group", "OK");
    int row = 1;// a counter for the current row
    // prepare the file for serial access
    testFile.resetSerialAccess();
    // loop through all the records in the event file
    while (testFile.moreSerialRecords()) {
       // read the next record
       Test test = (Test) testFile.getNextSerialValue();{
          // retrieve the reason
          // add a row to the table and put the values in
          table.addRow();
          table.setValueAt(test.testNo, row, 1);
          table.setValueAt(test.date, row, 2);
          table.setValueAt(test.yearGroup, row, 3);
          row++;
    }
    table.choice();
    }
  
   }// end of method
  </code></pre>
  
  <p>Nothing from the test database (test class) is showing on the table.</p>