removed downloadProgressLabel, display number of downloaded files using progress bar's setString method
parent
84cb970ab0
commit
08a5a2e6f6
|
@ -45,7 +45,6 @@ public class DownloadImagesDialog extends JFrame implements Runnable,ActionListe
|
||||||
private final JTextField portTextField;
|
private final JTextField portTextField;
|
||||||
private final JProgressBar progressBar;
|
private final JProgressBar progressBar;
|
||||||
private final JLabel downloadLabel;
|
private final JLabel downloadLabel;
|
||||||
private final JLabel downloadProgressLabel;
|
|
||||||
private final JLabel dirChosen;
|
private final JLabel dirChosen;
|
||||||
private final JButton okButton;
|
private final JButton okButton;
|
||||||
private final JButton cancelButton;
|
private final JButton cancelButton;
|
||||||
|
@ -211,18 +210,6 @@ public class DownloadImagesDialog extends JFrame implements Runnable,ActionListe
|
||||||
GAP,
|
GAP,
|
||||||
SpringLayout.WEST, contentPane);
|
SpringLayout.WEST, contentPane);
|
||||||
|
|
||||||
downloadProgressLabel = new JLabel();
|
|
||||||
downloadProgressLabel.setText("");
|
|
||||||
add(downloadProgressLabel);
|
|
||||||
springLayout.putConstraint(
|
|
||||||
SpringLayout.BASELINE, downloadProgressLabel,
|
|
||||||
0,
|
|
||||||
SpringLayout.BASELINE, progressLabel);
|
|
||||||
springLayout.putConstraint(
|
|
||||||
SpringLayout.WEST, downloadProgressLabel,
|
|
||||||
RGAP,
|
|
||||||
SpringLayout.EAST, progressLabel);
|
|
||||||
|
|
||||||
progressBar=new JProgressBar();
|
progressBar=new JProgressBar();
|
||||||
add(progressBar);
|
add(progressBar);
|
||||||
springLayout.putConstraint(
|
springLayout.putConstraint(
|
||||||
|
@ -287,6 +274,8 @@ public class DownloadImagesDialog extends JFrame implements Runnable,ActionListe
|
||||||
progressBar.setValue(1);
|
progressBar.setValue(1);
|
||||||
downloadLabel.setText("All images and text are present.");
|
downloadLabel.setText("All images and text are present.");
|
||||||
} else {
|
} else {
|
||||||
|
progressBar.setString("0/" + files.size());
|
||||||
|
progressBar.setStringPainted(true);
|
||||||
downloadLabel.setText("Press OK to begin or Cancel.");
|
downloadLabel.setText("Press OK to begin or Cancel.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,10 +324,8 @@ public class DownloadImagesDialog extends JFrame implements Runnable,ActionListe
|
||||||
int count=0;
|
int count=0;
|
||||||
|
|
||||||
for (final WebDownloader file : files) {
|
for (final WebDownloader file : files) {
|
||||||
final int curr = count + 1;
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
downloadProgressLabel.setText(curr+"/"+files.size());
|
|
||||||
downloadLabel.setText(file.getFilename());
|
downloadLabel.setText(file.getFilename());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -369,6 +356,7 @@ public class DownloadImagesDialog extends JFrame implements Runnable,ActionListe
|
||||||
final int fcount = count;
|
final int fcount = count;
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
progressBar.setString(fcount+"/"+files.size());
|
||||||
progressBar.setValue(fcount);
|
progressBar.setValue(fcount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue