RTSI r = new RTSI(); Collections.sort(files, r.new StringCompare());
  public void actionPerformed(ActionEvent e) {    boolean useRelativePaths = m_relativeCheck.isSelected();    if (e.getSource() == m_AddBut) {      // Let the user select an arff file from a file chooser      int returnVal = m_FileChooser.showOpenDialog(this);      if(returnVal == JFileChooser.APPROVE_OPTION) {	if (m_FileChooser.isMultiSelectionEnabled()) {	  File [] selected = m_FileChooser.getSelectedFiles();	  for (int i = 0; i < selected.length; i++) {	    if (selected[i].isDirectory()) {	      Vector files = new Vector();	      getFilesRecursively(selected[i], files);	      for (int j = 0; j < files.size(); j++) {		File temp = (File)files.elementAt(j);		if (useRelativePaths) {		  try {		    temp = convertToRelativePath(temp);		  } catch (Exception ex) {		    ex.printStackTrace();		  }		}		m_Exp.getDatasets().addElement(temp);	      }	    } else {	      File temp = selected[i];	      if (useRelativePaths) {		try {		  temp = convertToRelativePath(temp);		} catch (Exception ex) {		  ex.printStackTrace();		}	      }	      m_Exp.getDatasets().addElement(temp);	    }	  }	  m_DeleteBut.setEnabled(true);	} else {	  if (m_FileChooser.getSelectedFile().isDirectory()) {	    Vector files = new Vector();	    getFilesRecursively(m_FileChooser.getSelectedFile(), files);	    for (int j = 0; j < files.size(); j++) {	      File temp = (File)files.elementAt(j);	      if (useRelativePaths) {		try {		  temp = convertToRelativePath(temp);		} catch (Exception ex) {		  ex.printStackTrace();		}	      }	      m_Exp.getDatasets().addElement(temp);	    }	  } else {	    File temp = m_FileChooser.getSelectedFile();	    if (useRelativePaths) {	      try {		temp = convertToRelativePath(temp);	      } catch (Exception ex) {		ex.printStackTrace();	      }	    }	    m_Exp.getDatasets().addElement(temp);	  }	  m_DeleteBut.setEnabled(true);	}      }    } else if (e.getSource() == m_DeleteBut) {      // Delete the selected files      int [] selected = m_List.getSelectedIndices();      if (selected != null) {	for (int i = selected.length - 1; i >= 0; i--) {	  int current = selected[i];	  m_Exp.getDatasets().removeElementAt(current);	  if (m_Exp.getDatasets().size() > current) {	    m_List.setSelectedIndex(current);	  } else {	    m_List.setSelectedIndex(current - 1);	  }	}      }      if (m_List.getSelectedIndex() == -1) {	m_DeleteBut.setEnabled(false);      }    }  }