i have a downloader application that uses right now the regular terminal (system.out.println, yeah).
that application has a listener that fires every second and tells me how much it transferred.
i would like to use lanterna to show a progressbar instead that system.out.println, but i am failing.
the progressbar is shown once (when i debug), and then only a blue screen, no updates etc.
but when i debug, i see that the progressbar has the correct values and also the window looks ok
i assume its a threading problem, but no idea ...
that method i have is:
@Override
public void transfered(Dto dto, String remoteFilename, long bytes, long size) {
if (!downloadProgress.containsKey(remoteFilename)) {
downloadProgress.put(remoteFilename, bytes);
} else {
Long aLong = downloadProgress.get(remoteFilename);
long transferred = aLong + bytes;
downloadProgress.put(remoteFilename, transferred);
}
long percent = downloadProgress.get(remoteFilename) * 100 / size;
System.out.println("\rTransfered " + percent + "% for " + remoteFilename);
progressBar.setValue((int) percent);
}
my text is shown in a terminal, that is correct. but somehow, progressbar is not updated :/
in the constructor i use:
final ProgressBar progressBar = new ProgressBar(0, 100, 10);
final BasicWindow transferWindow = new BasicWindow("Downloading...");
transferWindow.setComponent(progressBar);
and just before the download starts i set the window once with:
textGUI.addWindow(transferWindow);
i have a downloader application that uses right now the regular terminal (system.out.println, yeah). that application has a listener that fires every second and tells me how much it transferred. i would like to use lanterna to show a progressbar instead that system.out.println, but i am failing. the progressbar is shown once (when i debug), and then only a blue screen, no updates etc. but when i debug, i see that the progressbar has the correct values and also the window looks ok
i assume its a threading problem, but no idea ...
that method i have is:
my text is shown in a terminal, that is correct. but somehow, progressbar is not updated :/ in the constructor i use:
and just before the download starts i set the window once with: textGUI.addWindow(transferWindow);
any idea?