public void update() throws SQLException { tasks = taskDAO.loadAll(); tasksTableModel = new TasksTableModel(tasks); tasksTable.setModel(tasksTableModel); }
private void edit() { int selectedRow = tasksTable.getSelectedRow(); if (selectedRow == -1) { return; } Task task = tasks.get(selectedRow); editDialog.setTask(task); editDialog.setVisible(true); if (!editDialog.isOk()) { return; } try { taskDAO.save(task); update(); } catch (SQLException e) { JOptionPane.showMessageDialog( this, "Error while saving", "todo - Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } }