private void progress() { if (display()) { final ImageJ ij = IJ.getInstance(); if (ij != null) { // To avoid exceptions in ImageJ batch mode final ProgressBar pb = ij.getProgressBar(); if (pb != null) { final double lo = min(); final double hi = max(); pb.show(lo + percent * (hi - lo)); if (enforce()) { final Graphics gx = pb.getGraphics(); if (gx != null) pb.paint(gx); // Enforces a refresh also when called from event stack } } } } }