calculateButton.setEnabled( !table.getSelectionModel().isSelectionEmpty() && collectionCombo.getSelectedIndex() >= 0);
if (!calculating) calculateButton.setEnabled( !table.getSelectionModel().isSelectionEmpty() && collectionCombo.getSelectedIndex() >= 0);
			public void actionPerformed(ActionEvent e) {				if (calculating) {					calculateButton.setText("Calculate");					calculateRemaining = false;					calculateButton.setEnabled(false);				} else {					calculateButton.setText("Do not calculate remaining");					collectionCombo.setEnabled(false);					calculateRemaining = true;					final List indices = new LinkedList(); 					for (int i = 0;	i < sorter.getRowCount(); i++) {						if (table.getSelectionModel().isSelectedIndex(i)) {							//evalsModel.calculate(sorter.modelIndex(i));							indices.add(new Integer(sorter.modelIndex(i)));						}					}					new Thread(new Runnable() {						public void run() {							calculating = true;							console.append("\nCALCULATION:\n\n");							Iterator it = indices.iterator();							int counter = 1;							while (it.hasNext() && calculateRemaining) {								int rowIndex = ((Integer)it.next()).intValue();								console.append("Calculating '" + evalsModel.getValueAt(rowIndex,0) + "'"										+ "  ["+(counter++)+"/"+indices.size()+"] ...");								evalsModel.calculate(rowIndex);								console.append(" done.\n");							}							calculating = false;							EventQueue.invokeLater(new Runnable() {								public void run() {									calculateButton.setText("Calculate");									calculateButton.setEnabled(										!table.getSelectionModel().isSelectionEmpty() &&										collectionCombo.getSelectedIndex() >= 0);									collectionCombo.setEnabled(true);								}							});						}					}).start();				}			}