linkContent) {
try {
String str = linkContent.get();
Matcher m = Pattern.compile(".*josm-tested\\.jar: *(\\d+).*", Pattern.DOTALL).matcher(str);
m.matches();
int curVersion = Integer.parseInt(m.group(1));
m = Pattern.compile(".*josm-latest\\.jar: *(\\d+).*", Pattern.DOTALL).matcher(str);
m.matches();
int latest = Integer.parseInt(m.group(1));
return ""
+ ""
+ (curVersion > myVersion ? tr("Update available") + " ": "")
+ tr("Version Details:") + " "
+ tr("Yours: {2}; Current: {0}; "
+ "(latest untested: {1} not recommended)",
curVersion, latest, myVersion)
+ "
";
} catch(Exception e) {
// e.printStackTrace();
}
return "";
}
}
/**
* Initializes getting the MOTD as well as enabling the FileDrop Listener.
* Displays a message while the MOTD is downloading.
*/
public GettingStarted() {
super(new BorderLayout());
final LinkGeneral lg = new LinkGeneral(
"" +
styles +
"" +
"JOSM - " +
tr("Java OpenStreetMap Editor") +
"
" +
tr("Downloading \"Message of the day\"") +
"
");
JScrollPane scroller = new JScrollPane(lg);
scroller.setViewportBorder(new EmptyBorder(10,100,10,100));
add(scroller, BorderLayout.CENTER);
// Asynchronously get MOTD to speed-up JOSM startup
Thread t = new Thread(new Runnable() {
public void run() {
if (content.length() == 0 && Main.pref.getBoolean("help.displaymotd", true))
content = new assignContent().updateIfRequiredString();
EventQueue.invokeLater(new Runnable() {
public void run() {
lg.setText(content);
//lg.moveCaretPosition(0);
}
});
}
}, "MOTD-Loader");
t.setDaemon(true);
t.start();
new FileDrop(scroller);
}
}