final UserPreferences preferences,
final ContentManager contentManager) {
// Read image in imageLoader executor
this.imageLoader.execute(new Runnable() {
public void run() {
Content imageContent = null;
try {
// Copy image to a temporary content to keep a safe access to it until home is saved
imageContent = TemporaryURLContent.copyToTemporaryURLContent(
contentManager.getContent(imageName));
} catch (RecorderException ex) {
// Error message displayed below
} catch (IOException ex) {
// Error message displayed below
}
if (imageContent == null) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(SwingUtilities.getRootPane(BackgroundImageWizardStepsPanel.this),
preferences.getLocalizedString(BackgroundImageWizardStepsPanel.class,
"imageChoiceError", imageName));
}
});
return;
}
BufferedImage image = null;
try {
image = readImage(imageContent, preferences);
} catch (IOException ex) {
// image is null
}
final BufferedImage readImage = image;
final Content readContent = imageContent;
// Update components in dispatch thread
EventQueue.invokeLater(new Runnable() {
public void run() {
if (readImage != null) {
controller.setImage(readContent);