title: Moving a method into SwingWorker
body: <p>I am working on a program that analyzes DNA. The main work of the program is in a method that takes in a certain file type, parses the file and converts it into a string, then parses the string to separate it into segments. It then returns the results of the analysis in a <code>JTable</code> on a new <code>JFrame</code>.</p>
  
  <pre><code>public  JTable readFile(File file) throws IOException{
      BufferedReader in = new BufferedReader(new FileReader(file));
      String line;
      String result = "";
      while((line=in.readLine())!=null) {
         if(!line.startsWith("&gt;")) {
                result = result + line;
                 }            
      }       
  
      Sequence sequence = new Sequence("Unspecified", result);
      ArrayList&lt;Contig&gt; contigs = sequence.getReadingFrames();
  
      String [] columnNames = {"Position", "Frame", "Sequence"};
  
       Object[][] data = new Object[contigs.size()][3];
       int j = 0;
      for (int i = 0; i &lt;= contigs.size() &amp;&amp; j &lt; 3; i++){
          if (i == contigs.size()){
              j++;
              i = -1;
          }
          else if (j == 0){
              data[i][j] = Integer.toString(contigs.get(i).getStartPosition());   
          }
          else if (j == 1){
              data[i][j] = Integer.toString(contigs.get(i).getReadingFrame());
          }
          else if (j == 2){
              data[i][j] = contigs.get(i).getSequence();
          }
      }
      JTable seqTable = new JTable(data, columnNames);
      in.close();
      return seqTable;
  }
  </code></pre>
  
  <p>How should I go about moving this into a <code>SwingWorker</code>? I tried a copy, paste, and edit, but the whole thing just returns empty results.</p>