Package org.sfsoft.descargarficheros.tareas

Examples of org.sfsoft.descargarficheros.tareas.Descarga


  private JButton btDescarga;
  private JProgressBar pbDescarga;

  private void descargarFichero() {
   
    Descarga descarga = null;
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.showSaveDialog(null);
    File rutaFichero = fileChooser.getSelectedFile();
   
    try {
     
      descarga = new Descarga(tfUrl.getText(), rutaFichero.getAbsolutePath());
      descarga.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent event) {
          if (event.getPropertyName().equals("progress")) {
            pbDescarga.setValue((Integer) event.getNewValue());
          }
        }
      });
      descarga.execute();
     
    } catch (Exception e) {
      if (e instanceof MalformedURLException)
        JOptionPane.showMessageDialog(null, "La URL no es correcta", "Descargar Fichero", JOptionPane.ERROR_MESSAGE);
      else if (e instanceof FileNotFoundException)
View Full Code Here

TOP

Related Classes of org.sfsoft.descargarficheros.tareas.Descarga

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.