@Override public void botaoNovoActionPerformed(ActionEvent evt) { form = new ProfissionalFormulario(this, true); form.popularCampos(new Profissional()); form.setLocationRelativeTo(null); form.setVisible(true); }
@Override public void botaoEditarActionPerformed(ActionEvent evt) { try { int selected = getTabela().getSelectedRow(); Object registro = getTabela().getValueAt(selected, 0); int profissional_id = Integer.parseInt(registro.toString()); Object profissional = ProfissionalDAO.getInstance().getById(new Profissional(), profissional_id); form = new ProfissionalFormulario(this, true); form.popularCampos((Profissional) profissional); form.setLocationRelativeTo(null); form.setVisible(true); } catch (Exception err) { SOptionPane.showMessageDialog(this, err, "Erro!", JOptionPane.ERROR_MESSAGE); } }