progress bar threading tweaks

This commit is contained in:
adam-m 2013-03-05 13:47:24 -05:00
parent 47eb2cfd7c
commit 589cf178eb

View File

@ -16,9 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.timeline;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
@ -74,23 +74,39 @@ public class TimelineProgressDialog extends javax.swing.JDialog {
return returnStatus;
}
void updateProgressBar(int progress) {
this.progressBar.setValue(progress);
void updateProgressBar(final int progress) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
progressBar.setValue(progress);
}
});
}
void updateProgressBar(String message) {
this.progressBar.setStringPainted(true);
this.progressBar.setString(message);
void updateProgressBar(final String message) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
progressBar.setString(message);
}
});
}
void setProgressTotal(int total) {
this.progressBar.setIndeterminate(false);
this.progressBar.setMaximum(total);
this.progressBar.setValue(0);
void setProgressTotal(final int total) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
progressBar.setIndeterminate(false);
progressBar.setMaximum(total);
progressBar.setValue(0);
progressBar.setStringPainted(true);
}
});
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
@ -144,14 +160,11 @@ public class TimelineProgressDialog extends javax.swing.JDialog {
doClose(RET_CANCEL);
}//GEN-LAST:event_closeDialog
public void doClose(int retStatus) {
returnStatus = retStatus;
setVisible(false);
dispose();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JProgressBar progressBar;