new Thread(new Runnable() {
@Override
public void run() {
ImageProcessHandler mainProcess;
if(!preview){
mainProcess = new ImageProcessHandler(model);
} else {
ImportedImage importedImage = (ImportedImage) model.get(jList1.getSelectedIndex());
mainProcess = new ImageProcessHandler(importedImage);
}
OutputParameters outputParameters = null;
ResizeParameters resizeParameters = null;
RotateParameters rotateParameters = null;
WatermarkParameters watermarkParameters = null;
for (int i = 0; i < jTabbedPane1.getComponentCount(); i++) {
ImageEditParameters imageEditParameters = ((ImageEditTab) jTabbedPane1.getComponentAt(i)).getImageEditParameters();
if (imageEditParameters instanceof OutputParameters) {
outputParameters = (OutputParameters) imageEditParameters;
} else if (imageEditParameters instanceof ResizeParameters) {
resizeParameters = (ResizeParameters) imageEditParameters;
} else if (imageEditParameters instanceof RotateParameters) {
rotateParameters = (RotateParameters) imageEditParameters;
} else if (imageEditParameters instanceof WatermarkParameters) {
watermarkParameters = (WatermarkParameters) imageEditParameters;
}
}
mainProcess.setResizeParameters(resizeParameters);
mainProcess.setRotateParameters(rotateParameters);
mainProcess.setWatermarkParameters(watermarkParameters);
mainProcess.setOutputParameters(outputParameters);
mainProcess.start();
}
}).start();
}