Esempio n. 1
0
  private void jMenuItem3ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jMenuItem3ActionPerformed
    try {

      FileChooser fc = new FileChooser("Seleccione un archivo xml con Programas", this);

      final String nombreFile = fc.showChooser();
      if (!nombreFile.isEmpty()) {
        worker.execute();
        Thread t =
            new Thread() {
              @Override
              public void run() {
                try {
                  resultado = NegocioFacade.cargarProgramas(nombreFile);
                  worker.done();
                  DisplayResultado.showResultado(getThisFrame(), "Carga Programas", resultado);
                } catch (NegocioPaooException ex) {
                  worker.done();
                  resultado = new Resultado("Ocurrio un problema al cargar los datos");
                  resultado.setTipo(Resultado.TIPO_RESULTADO.EXCEPTION);
                  DisplayResultado.showResultado(getThisFrame(), "Carga Programas", resultado);
                }
              }
            };
        t.start();
      }
    } catch (PropiedadesPaooException ex) {
      worker.done();
      resultado = new Resultado("Ocurrio un problema al cargar los datos");
      resultado.setTipo(Resultado.TIPO_RESULTADO.EXCEPTION);
      DisplayResultado.showResultado(getThisFrame(), "Carga Programas", resultado);
    }
  } // GEN-LAST:event_jMenuItem3ActionPerformed
Esempio n. 2
0
 /** Creates new form MenuPrincipal */
 public MenuPrincipal() {
   initComponents();
   worker = new LoadingCaller(this);
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
     resultado = new Resultado("Ocurrio un problema al iniciar el programa");
     resultado.setTipo(Resultado.TIPO_RESULTADO.EXCEPTION);
     DisplayResultado.showResultado(getThisFrame(), "Inicio", resultado);
   }
   this.setIconImage(
       (new javax.swing.ImageIcon(
               getClass().getResource("/uy/edu/ort/paoo/presentacion/swing/img/ico.png")))
           .getImage());
   this.setLocationRelativeTo(null);
 }