public void actionPerformed(ActionEvent event) { int answer = JOptionPane.showConfirmDialog( HarvesterGUI.this, "Are you sure you want to start all?", "Start All", JOptionPane.YES_NO_OPTION); System.out.println("answer " + answer); if (answer == JOptionPane.YES_OPTION) { for (HarvestTask task : tableModel.getTasks()) { if (HarvestTask.isStartable(task.getStatus())) { control.add(task); } } setEnablement(); } }
private void setEnablement() { startSelectedAction.setEnabled( selectedTask != null && HarvestTask.isStartable(selectedTask.getStatus())); abortAction.setEnabled( selectedTask != null && !HarvestTask.isStartable(selectedTask.getStatus())); }