title: jtable data getting replaced with previous result when double clicked
body: <p>I am developing one application in Swing in which I scan data from some files and show it in JTable on UI and when I double click on row respective file gets opened. Code of 'Scan' button is as follows,</p>
  
  <pre><code>JButton btnStart = new JButton("Scan");
      btnStart.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {                         
  
                  File dir = new File(chooser.getSelectedFile(), chooser.getSelectedFile().getAbsolutePath());                
                  System.out.println("dir " + dir);
                  File[] firstLevelFiles = chooser.getSelectedFile().listFiles();
                  if (firstLevelFiles != null &amp;&amp; firstLevelFiles.length &gt; 0) {
                      for (File aFile : firstLevelFiles) {
                          if (aFile.isDirectory()) {
                              listDirectory(aFile.getAbsolutePath(), level + 1);
                          } else {                            
                              fileExt=aFile.getName().substring(aFile.getName().lastIndexOf(".")+1);                                                      
                              for (String string : selectedExt) {
                                  if(string.equals(fileExt)){ 
                                      fileList.add(aFile);    
                                  }                                                       
                              }
                          }
                      }
                  }                   
  
                  MyFileReader myFileReader=new MyFileReader();
  
                  new Thread(new Runnable(){
                      @Override
                      public void run(){
  
                          fileMap=myFileReader.fileReader(fileList, filepath);
                         if(!fileMap.isEmpty()){
                           SwingUtilities.invokeLater(new Runnable(){
                               @Override public void run(){
  
                                      int tableSize=myFileReader.getTableSize();
  
                                      tableData=new String[tableSize][4];
                                      Iterator it = fileMap.entrySet().iterator();
                                      int j=0;
                                      int k=0;                                        
                                      while (it.hasNext()) {
                                          Map.Entry pair = (Map.Entry) it.next();                                         
                                          List&lt;String&gt; ls = (List&lt;String&gt;) pair.getValue();
                                          for (int i = 1; i &lt;= ls.size(); i++) {
                                              if(k==1){
                                                  k++;
                                                  i--;
                                                  continue;
                                              }
  
                                              tableData[j][1]=pair.getKey().toString();
                                              tableData[j][k]=ls.get(i-1).toString();
                                              k++;
                                              if(k==4){
                                                  k=0;
                                                  j++;
                                              }
                                          }
                                      }                                                                               
                                       model = new DefaultTableModel(tableData, columns)
                                        {
                                          public boolean isCellEditable(int row, int column)
                                          {
                                            return false;//This causes all cells to be not editable
                                          }
                                        };
  
                                      table = new JTable(model);                                                                  
                                      table.setEnabled(true);
                                      JTableHeader header = table.getTableHeader();
                                      header.setBackground(Color.LIGHT_GRAY);
                                      table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                                      table.setCellSelectionEnabled(true);
                                      table.getColumnModel().getColumn(0).setPreferredWidth(5);
                                      table.getColumnModel().getColumn(1).setPreferredWidth(400);
                                      table.getColumnModel().getColumn(2).setPreferredWidth(5);
                                      table.getColumnModel().getColumn(3).setPreferredWidth(5);
  
                                      pane = new JScrollPane(table);
                                      pane.setBounds(70,250,1000,300);
                                      pane.setVisible(true);
                                      contentPane.add(pane,BorderLayout.CENTER);
  
                                      table.addMouseListener(new MouseAdapter() {
                                           public void mouseClicked(MouseEvent e) {
                                              if (e.getClickCount() == 2) {
                                                  int columnChk=table.getSelectedColumn();
                                                  if (columnChk == 1) {
                                                      String fpath = getSelectedData(table);
  
                                                      try {
                                                          Runtime runtime = Runtime.getRuntime();
                                                          runtime.exec("explorer " + fpath);
  
                                                      } catch (IOException e1) {
                                                          // TODO Auto-generated catch block
                                                          e1.printStackTrace();
                                                      }
                                                  }
                                              }
                                           }
                                        });
                                   scanProg.setText("Scanning Completed");
                             }
                            });
                         }else {
                              scanProg.setText("No codebase found");
                         }
                      }
                      }).start();                                                     
              }
  
  
          }
      });
      btnStart.setBounds(324, 154, 89, 23);
      contentPane.add(btnStart);
  </code></pre>
  
  <p>Now, when I rescan files without closing frame new data is getting filled in JTable but once I double click on any row it's data is getting replaced with previous one which is not desired.<strong>I want to clear data from table from privious scan.</strong> Already have tried JTable.removeall() but it didnt helped. 
  <a href="https://i.stack.imgur.com/bOfFR.png" rel="nofollow noreferrer">Screenshot of table is here</a>
  Any idea?</p>