Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
String message;
String title;
VersionChecker version;
URL downloadURL = null;
boolean downloadOption = false;
String jarURL = null;
try {
LOGGER.debug("Checking for new version...");
version = VersionChecker.getInstance();
// A newer version is available
if(version.isNewVersionAvailable()) {
LOGGER.info("A new version is available!");
title = Translator.get("version_dialog.new_version_title");
// Checks if the current platform can open a new browser window
downloadURL = new URL(version.getDownloadURL());
downloadOption = DesktopManager.isOperationSupported(DesktopManager.BROWSE, new Object[] {downloadURL});
// If the platform is not capable of opening a new browser window,
// display the download URL.
if(downloadOption) {
message = Translator.get("version_dialog.new_version");
}
else {
message = Translator.get("version_dialog.new_version_url", downloadURL.toString());
}
jarURL = version.getJarURL();
}
// We're already running latest version
else {
LOGGER.debug("No new version.");