public void actionPerformed(ActionEvent e) { int index = list.getSelectedIndex(); try { waitField.commitEdit(); checkField.commitEdit(); } catch (java.text.ParseException x) { printer.printError(x.toString()); return; } Directory task = directoryList.getDirectory(index); startButton.setEnabled(false); task.setWaitInterval(((Number) waitField.getValue()).intValue()); task.setInterval(((Number) checkField.getValue()).intValue()); Path destination = task.getDestination(); Path directory = task.getDirectory(); task.backupNumber = 1; timer = new Timer(); timer.schedule( new CopyTask(directory, destination, task.waitInterval, printer, copy), 0, task.interval); timers.add(timer); stopButton.setEnabled(true); log.setCaretPosition(log.getDocument().getLength()); }
public void actionPerformed(ActionEvent e) { int index = list.getSelectedIndex(); stopButton.setEnabled(false); timers.get(index).cancel(); timers.remove(index); startButton.setEnabled(true); Directory task = directoryList.getDirectory(index); task.backupNumber = 0; log.setCaretPosition(log.getDocument().getLength()); }