Esempio n. 1
0
 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");
   }
 }
Esempio n. 2
0
  private void jTableMouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jTableMouseClicked
    try {

      int result =
          JOptionPane.showConfirmDialog(
              null, "Deseja pegar esse cliente?", "Confirmar", JOptionPane.YES_NO_OPTION);
      if (result == JOptionPane.YES_OPTION) {
        int index = this.jTable.getSelectedRow();
        String idString = this.jTable.getValueAt(index, 0).toString();
        long idExame = Long.parseLong(idString);
        this.exame = facade.exameBuscar(idExame);
        // JOptionPane.showMessageDialog(null, facade.ClienteBuscar(idCliente).getNome());
      } else {
        this.exame = null;
      }
      dispose();
      // dispose();
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, "Deu Páia!");
    }
  } // GEN-LAST:event_jTableMouseClicked