Some small tidying.
This commit is contained in:
@@ -453,6 +453,37 @@ public abstract class Getdown extends Thread
|
||||
setStatus(message, -1, -1L, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the image at the path. Before trying the exact path/file specified we will look to see
|
||||
* if we can find a localized version by sticking a _<language> in front of the "." in the
|
||||
* filename.
|
||||
*/
|
||||
public BufferedImage loadImage (String path)
|
||||
{
|
||||
if (StringUtil.isBlank(path)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
File imgpath = null;
|
||||
try {
|
||||
// First try for a localized image.
|
||||
String localeStr = Locale.getDefault().getLanguage();
|
||||
imgpath = _app.getLocalPath(StringUtil.replace(path, ".", "_" + localeStr + "."));
|
||||
return ImageIO.read(imgpath);
|
||||
} catch (IOException ioe) {
|
||||
// No biggie, we'll try the generic one.
|
||||
}
|
||||
|
||||
// If that didn't work, try a generic one.
|
||||
try {
|
||||
imgpath = _app.getLocalPath(path);
|
||||
return ImageIO.read(imgpath);
|
||||
} catch (IOException ioe2) {
|
||||
Log.warning("Failed to load image [path=" + imgpath + ", error=" + ioe2 + "].");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads and installs an Java VM bundled with the application. This is called if we are not
|
||||
* running with the necessary Java version.
|
||||
@@ -717,7 +748,6 @@ public abstract class Getdown extends Thread
|
||||
}
|
||||
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
|
||||
public void run () {
|
||||
if (_status == null) {
|
||||
_container = createContainer();
|
||||
@@ -735,8 +765,8 @@ public abstract class Getdown extends Thread
|
||||
{
|
||||
if (_ifc.rotatingBackgrounds != null) {
|
||||
if (_ifc.backgroundImage != null) {
|
||||
Log.warning("ui.background_image and ui.rotating_background were "
|
||||
+ " both specified. The rotating images are being used.");
|
||||
Log.warning("ui.background_image and ui.rotating_background were both specified. " +
|
||||
"The rotating images are being used.");
|
||||
}
|
||||
return new RotatingBackgrounds(_ifc.rotatingBackgrounds, Getdown.this);
|
||||
} else if (_ifc.backgroundImage != null) {
|
||||
@@ -812,38 +842,6 @@ public abstract class Getdown extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the image at the path. Before trying the exact path/file specified
|
||||
* we will look to see if we can find a localized version by sticking a
|
||||
* _<language> in front of the "." in the filename.
|
||||
*/
|
||||
public BufferedImage loadImage (String path)
|
||||
{
|
||||
String localeStr = Locale.getDefault().getLanguage();
|
||||
|
||||
if (StringUtil.isBlank(path)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
File imgpath = null;
|
||||
try {
|
||||
// First try for a localized image.
|
||||
imgpath = _app.getLocalPath(StringUtil.replace(path, ".", "_" + localeStr + "."));
|
||||
return ImageIO.read(imgpath);
|
||||
} catch (IOException ioe) {
|
||||
// No biggie, we'll try the generic one.
|
||||
}
|
||||
|
||||
// If that didn't work, try a generic one.
|
||||
try {
|
||||
imgpath = _app.getLocalPath(path);
|
||||
return ImageIO.read(imgpath);
|
||||
} catch (IOException ioe2) {
|
||||
Log.warning("Failed to load image [path=" + imgpath + ", error=" + ioe2 + "].");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the container in which our user interface will be displayed.
|
||||
*/
|
||||
|
||||
@@ -57,16 +57,16 @@ public class GetdownApplet extends JApplet
|
||||
if (appname == null) {
|
||||
appname = "";
|
||||
}
|
||||
|
||||
final RotatingBackgrounds bgimages;
|
||||
if(imgpath == null) {
|
||||
if (imgpath == null) {
|
||||
bgimages = new RotatingBackgrounds();
|
||||
} else if(imgpath.contains(",")) {
|
||||
} else if (imgpath.contains(",")) {
|
||||
bgimages = new RotatingBackgrounds(imgpath.split(","), this);
|
||||
} else {
|
||||
bgimages = new RotatingBackgrounds(loadImage(imgpath));
|
||||
}
|
||||
|
||||
|
||||
Log.info("App Base: " + appbase);
|
||||
Log.info("App Name: " + appname);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user