Example #1
0
 private void aceptarActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_aceptarActionPerformed
   Cliente c = new Cliente();
   if (!fieldNombre.getText().equals("")
       && !fieldApellido.getText().equals("")
       && !fieldCuit.getText().equals("")) {
     try {
       c.setNombre(fieldNombre.getText());
       c.setApellido(fieldApellido.getText());
       c.setCuit((Long.parseLong(fieldCuit.getText())));
       ClientesApp.getClienteC().create(c);
       tableClientes.setModel(new ClienteTableModel());
       fieldNombre.setText("");
       fieldNombre.setEnabled(false);
       fieldApellido.setText("");
       fieldApellido.setEnabled(false);
       fieldCuit.setText("");
       fieldCuit.setEnabled(false);
       aceptar.setEnabled(false);
       cancelar.setEnabled(false);
     } catch (NumberFormatException ex) {
       JOptionPane.showMessageDialog(
           null, "Cuit no es numérico", "Error", JOptionPane.ERROR_MESSAGE);
     }
   } else
     JOptionPane.showMessageDialog(
         null, "Complete los campos obligatorios.", "Error", JOptionPane.ERROR_MESSAGE);
 } // GEN-LAST:event_aceptarActionPerformed
Example #2
0
  private void jbDireccionesActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jbDireccionesActionPerformed
    if (tableClientes.getSelectedRow() != -1) {
      Integer fila = tableClientes.getSelectedRow();
      Long id = (Long) tableClientes.getModel().getValueAt(fila, 0);

      Cliente c = (Cliente) ClientesApp.getClienteC().findCliente(id);
      Direcciones d = new Direcciones(c);
      Aplicacion.getApp()
          .addFrame(d, "Direcciones de " + (String) c.getApellido() + " " + (String) c.getNombre());
    } else
      JOptionPane.showMessageDialog(
          null, "No ha seleccionado ningun cliente", "Error", JOptionPane.ERROR_MESSAGE);
  } // GEN-LAST:event_jbDireccionesActionPerformed