/**
* Display a preview of the image to be printed in a popup window.
**/
public void preview() {
SwingWorker worker = new SwingWorker() {
public Object construct() {
try {
String title = _imageDisplay.getObjectName();
if (title == null)
title = _imageDisplay.getFilename();
if (title == null)
title = _I18N.getString("printPreview");
startPrint(_I18N.getString("preparingImage"));
return new PrintPreview(ImagePrintDialog.this, ImagePrintDialog.this, title);
} catch (Exception e) {
return e;
}
}
public void finished() {
_progressPanel.stop();
_progressPanel.setTitle(_I18N.getString("printingImage"));
Object o = getValue();
if (o instanceof Exception) {
DialogUtil.error((Exception) o);
} else if (o instanceof PrintPreview) {
PrintPreview pp = (PrintPreview) o;
pp.setVisible(true);
}
}
};
worker.start();
}