G
Guest
Gast
Hi,
ich habe nun alles in Thread umgeschrieben.
Das ganze sieht jetzt wie folgt aus:
Ich habe eine Hauptklasse, diese ruft den Algorithmus auf (generiert einen Thread).
Dieser wiederrum ruft die Statusanzeige auf (auch als thread).
Das Problem ist nun, dass die ProgressBar nicht angezeigt wird.
Allerdings funktioniert die Audsgabe in der Konsole.
Woran liegt das?
Der Algorithmus:
Die ProgressBar:
Könnt ihr mir helfen?
Danke.
ich habe nun alles in Thread umgeschrieben.
Das ganze sieht jetzt wie folgt aus:
Ich habe eine Hauptklasse, diese ruft den Algorithmus auf (generiert einen Thread).
Dieser wiederrum ruft die Statusanzeige auf (auch als thread).
Das Problem ist nun, dass die ProgressBar nicht angezeigt wird.
Allerdings funktioniert die Audsgabe in der Konsole.
Woran liegt das?
Der Algorithmus:
Code:
PixelOfPicture[][] picture = this.picture.getActualPicture();
ProgressBar progress = new ProgressBar(numberOfRemovableRows , "Removing horizontal seam" , 0);
Thread progressThread = new Thread(progress);
progressThread.start();
for(int i = 0; i < numberOfRemovableRows; i++){
try{
picture = RemoveSeam.removeSeam(picture,false);
progress.setStatus(i);
}
catch(UnableToDeleteSeamException UTDSE){
break;
}
}
this.picture.setActualPicture(picture);
Die ProgressBar:
Code:
public void setStatus(int newStatus){
this.status = newStatus;
}
@Override
public void run() {
while (true) {
this.progressBar.setValue(this.status);
this.setDescription();
try {
Thread.sleep(10);
}
catch (InterruptedException e) {}
}
}
Könnt ihr mir helfen?
Danke.