[josm-dev] [PATCH] Make start-up feel faster by asynchronously loading the MOTD.
Michel Marti
mcdmx at users.sf.net
Mon Nov 17 20:37:17 GMT 2008
Since loading and parsing the MOTD from the wiki now takes place
in a separate thread, the main GUI will be ready for action (much)
earlier (especially on slow network links).
Signed-off-by: Michel Marti <mcdmx at users.sf.net>
---
src/org/openstreetmap/josm/gui/GettingStarted.java | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/org/openstreetmap/josm/gui/GettingStarted.java b/src/org/openstreetmap/josm/gui/GettingStarted.java
index 7174aeb..ae4ea86 100644
--- a/src/org/openstreetmap/josm/gui/GettingStarted.java
+++ b/src/org/openstreetmap/josm/gui/GettingStarted.java
@@ -134,11 +134,20 @@ public class GettingStarted extends JPanel {
public GettingStarted() {
super(new BorderLayout());
- assignContent();
-
+ final LinkGeneral lg = new LinkGeneral(tr("Loading MOTD..."));
+ JScrollPane scroller = new JScrollPane(lg);
+ // Asynchronously get MOTD to speed-up JOSM startup
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ assignContent();
+ lg.setText(content);
+ }
+ }, "MOTD-Loader");
+ t.setDaemon(true);
+ t.start();
+
// panel.add(GBC.glue(0,1), GBC.eol());
//panel.setMinimumSize(new Dimension(400, 600));
- JScrollPane scroller = new JScrollPane(new LinkGeneral(content));
scroller.setViewportBorder(new EmptyBorder(10,100,10,100));
add(scroller, BorderLayout.CENTER);
}
--
1.5.6.5
More information about the josm-dev
mailing list