Exemple #1
0
 public void getFuncLogin() {
   try {
     if (facade.funcionarioBuscarLogin(jtLogin.getText()) != null)
       usuario = facade.funcionarioBuscarLogin(jtLogin.getText());
   } catch (Exception ex) {
     ex.printStackTrace();
     System.out.println("erro: " + ex.getMessage());
   }
 }
 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");
   }
 }
  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