Skip to content
Snippets Groups Projects
Commit 214230bb authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

support for cancel

parent dca5c850
No related branches found
No related tags found
No related merge requests found
......@@ -49,10 +49,14 @@ public class ProgressDialog extends JDialog implements Progress {
public ProgressDialog(final Window owner) {
this(owner, null);
}
public ProgressDialog(Window owner, String title) {
this(owner, title, null);
}
public ProgressDialog(final Window owner, final String title) {
public ProgressDialog(final Window owner, final String title, Runnable cancelableAction) {
super(owner, title);
boolean canCancel = cancelableAction != null;
final Container root = getContentPane();
root.setLayout(new BoxLayout(root, BoxLayout.Y_AXIS));
progress = new JProgressBar();
......@@ -77,9 +81,12 @@ public class ProgressDialog extends JDialog implements Progress {
public void actionPerformed(final ActionEvent e) {
canceled = true;
ProgressDialog.this.dispose();
cancelableAction.run();
}
});
// buttons.add(cancel);
if(canCancel) {
buttons.add(cancel);
}
buttons.setMaximumSize(buttons.getMinimumSize());
root.add(buttons);
......
......@@ -86,7 +86,7 @@ public class ManageSPIMBenchmark implements Command {
final ImageJ ij = new ImageJ();
ij.launch(args);
ij.command().run(ManageSPIMBenchmark.class, true);
//ij.command().run(ManageSPIMBenchmark.class, true);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment