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)