private void preencherListaNome() throws Exception { DefaultTableModel dm = (DefaultTableModel) jTable.getModel(); dm.getDataVector().removeAllElements(); if (facade.exameListar() != null) { for (Exame exa : facade.exameListar()) { dm.addRow(new Object[] {exa.getId(), exa.getNome(), exa.getSetor()}); } } else JOptionPane.showMessageDialog(null, "Lista Null"); }
private void preencherListaId() throws Exception { DefaultTableModel dm = (DefaultTableModel) jTable.getModel(); dm.getDataVector().removeAllElements(); if (!"".equals(this.jtPesquisa.getText())) { long id = Integer.parseInt(this.jtPesquisa.getText()); Exame e = facade.exameBuscar(id); if (e != null) { for (Exame exa : facade.exameListar()) { if (exa.getId() == id) { dm.addRow(new Object[] {exa.getId(), exa.getNome(), exa.getSetor()}); } } } else JOptionPane.showMessageDialog(null, "Lista Null"); } }