Example #1
0
  /** Creates new form vistaComentarLibro */
  public vistaComentarLibro() {
    initComponents();
    try {
      // Intentamos conectarnos con el servidor
      // Si hay exito empezamos a consumir servicios
      if (conexion.iniciarRegistry()) {
        String Libros = new String();
        Libros = conexion.getServidor().ListadoLibros();
        String[] resultadoConsulta = Libros.split(";");

        if (!resultadoConsulta[0].equals("")) {
          for (int i = 0; i < resultadoConsulta.length; i++) {

            ListaLibros.addItem(resultadoConsulta[i]);
          }
        } else {
          JOptionPane.showMessageDialog(
              this, "No hay libros en el sistema", "Mensaje", JOptionPane.ERROR_MESSAGE);
          vistaInicioUsuario VIU = new vistaInicioUsuario();
          VIU.setLocationRelativeTo(null);
          VIU.setVisible(true);
          this.dispose();
        }

      } else {
        JOptionPane.showMessageDialog(
            this, "No se pudo Conectar", "Mensaje", JOptionPane.ERROR_MESSAGE);
      }

      // String seleccionado=(String)ListadoBiblios.getSelectedItem();

    } catch (RemoteException ex) {
      Logger.getLogger(vistaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Example #2
0
  private void BotonIngresarComentarioActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_BotonIngresarComentarioActionPerformed
    // TODO add your handling code here:
    String rut = vistaPrincipal.getAux();
    String comentario = this.IngresoComentario.getText();
    String seleccionado = (String) ListaLibros.getSelectedItem();

    if (contador == 0) {
      contador++;
    } else {
      System.out.println(seleccionado);
      contador++;

      try {
        // Intentamos conectarnos con el servidor
        // Si hay exito empezamos a consumir servicios
        if (conexion.iniciarRegistry()) {

          boolean Estado = conexion.getServidor().IngresoComentario(rut, seleccionado, comentario);

          if (Estado) {
            JOptionPane.showMessageDialog(
                this, "Su comentario ha sido recibido", "Mensaje", JOptionPane.INFORMATION_MESSAGE);
            vistaComentarLibro VCL = new vistaComentarLibro();
            VCL.setLocationRelativeTo(null);
            VCL.setVisible(true);
            this.dispose();
          } else {
            JOptionPane.showMessageDialog(
                this, "No se pudo ingresar su comentario", "Mensaje", JOptionPane.ERROR_MESSAGE);
          }

        } else {
          JOptionPane.showMessageDialog(
              this, "No se pudo Conectar", "Mensaje", JOptionPane.ERROR_MESSAGE);
        }

      } catch (RemoteException ex) {
        Logger.getLogger(vistaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  } // GEN-LAST:event_BotonIngresarComentarioActionPerformed