Damn, setIconImages is new in 1.6.

When I'm feeling more up to it, I'll potentially rejigger this to
allow its use if it's available, but for now just simplify it so
folks can set a single icon.
This commit is contained in:
Dave Hoover
2010-11-30 01:06:34 +00:00
parent dbc08da57c
commit f73333d951
2 changed files with 8 additions and 18 deletions
@@ -112,8 +112,8 @@ public class Application
/** The error background image for {@link RotatingBackgrounds}. */ /** The error background image for {@link RotatingBackgrounds}. */
public String errorBackground; public String errorBackground;
/** The paths (relative to the appdir) of file names for icon images. */ /** The path (relative to the appdir) of an image for the window icon. */
public String[] iconImages; public String iconImage;
/** The path (relative to the appdir) to a single background image. */ /** The path (relative to the appdir) to a single background image. */
public String backgroundImage; public String backgroundImage;
@@ -598,7 +598,7 @@ public class Application
} }
ui.progressImage = (String)cdata.get("ui.progress_image"); ui.progressImage = (String)cdata.get("ui.progress_image");
ui.rotatingBackgrounds = ConfigUtil.getMultiValue(cdata, "ui.rotating_background"); ui.rotatingBackgrounds = ConfigUtil.getMultiValue(cdata, "ui.rotating_background");
ui.iconImages = ConfigUtil.getMultiValue(cdata, "ui.icon"); ui.iconImage = (String)cdata.get("ui.icon");
ui.errorBackground = (String)cdata.get("ui.error_background"); ui.errorBackground = (String)cdata.get("ui.error_background");
_dockIconPath = (String)cdata.get("ui.mac_dock_icon"); _dockIconPath = (String)cdata.get("ui.mac_dock_icon");
if (_dockIconPath == null) { if (_dockIconPath == null) {
@@ -38,7 +38,6 @@ import java.io.IOException;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -125,21 +124,12 @@ public class GetdownApp
_frame.setTitle(title); _frame.setTitle(title);
_frame.getContentPane().removeAll(); _frame.getContentPane().removeAll();
} }
if (_ifc.iconImages != null) { if (_ifc.iconImage != null) {
ArrayList<Image> icons = new ArrayList<Image>(); Image img = loadImage(_ifc.iconImage);
for (String path : _ifc.iconImages) { if (img == null) {
Image img = loadImage(path); log.warning("Failed to load icon", "iconImage", _ifc.iconImage);
if (img == null) {
log.warning("Error loading icon image", "path", path);
} else {
icons.add(img);
}
}
if (icons.isEmpty()) {
log.warning("Failed to load any icons", "iconImages", _ifc.iconImages);
} else { } else {
_frame.setIconImages(icons); _frame.setIconImage(img);
} }
} }
_frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); _frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);