Example #1
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed

    try {
      interfaces op;
      op = (interfaces) Naming.lookup("rmi://localhost/persistencia");

      pre = op.buscaPregunta(Integer.parseInt(jTextField1.getText()));
      if (pre != null) {
        this.jLabel5.setText(Integer.toString(pre.getIdpregunta()));
        this.jTextField2.setText(pre.getPregunta());
        this.jTextField3.setText(pre.getRespuestacorrecta());
        this.jTextField1.setText("");
        Examen c;
        c = op.buscaExamen(pre.getExamen().getIdexamen());
        Materia t;
        t = op.buscaMateria(c.getMateria().getIdmateria());
        this.jComboBox1.setSelectedItem(
            exa.getIdexamen() + "-" + t.getNombre() + "-" + exa.getParcial());
        this.jTextField1.setText("");

      } else {
        JOptionPane.showMessageDialog(null, "No existe");
      }

    } catch (NotBoundException ex) {
      Logger.getLogger(PreguntasForm.class.getName()).log(Level.SEVERE, null, ex);
    } catch (MalformedURLException ex) {
      Logger.getLogger(PreguntasForm.class.getName()).log(Level.SEVERE, null, ex);
    } catch (RemoteException ex) {
      Logger.getLogger(PreguntasForm.class.getName()).log(Level.SEVERE, null, ex);
    }
  } // GEN-LAST:event_jButton1ActionPerformed