public void actionPerformed(ActionEvent e) {
      
      if (e.getSource() == m_defaultButton) {
	m_matrix.initialize();
	matrixChanged();
      } else if (e.getSource() == m_openButton) {
	openMatrix();
      } else if (e.getSource() == m_saveButton) {
	saveMatrix();
      } else if (    (e.getSource() == m_classesField) 
	          || (e.getSource() == m_resizeButton) ) {
	try {
	  int newNumClasses = Integer.parseInt(m_classesField.getText());
	  if (newNumClasses > 0 && newNumClasses != m_matrix.size()) {
	    setValue(new CostMatrix(newNumClasses));
	  }
	} catch (Exception ex) {}
      }
    }