From 5288ac12b510cf4fa404266e42e7c7955e042e1a Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Tue, 6 Mar 2012 12:47:53 +0100 Subject: [PATCH] Deferred mote height calculation until components are initialized --- .../java/se/sics/cooja/plugins/TimeLine.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/plugins/TimeLine.java b/tools/cooja/java/se/sics/cooja/plugins/TimeLine.java index 18b6f4782..6244740a8 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/TimeLine.java +++ b/tools/cooja/java/se/sics/cooja/plugins/TimeLine.java @@ -229,12 +229,6 @@ public class TimeLine extends VisPlugin { }); eventCheckboxes.add(eventCheckBox); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - recalculateMoteHeight(); - } - }); - /* Panel: timeline canvas w. scroll pane and add mote button */ timeline = new Timeline(); timelineScrollPane = new JScrollPane( @@ -268,6 +262,7 @@ public class TimeLine extends VisPlugin { getContentPane().add(splitPane); + recalculateMoteHeight(); pack(); setSize(gui.getDesktopPane().getWidth(), 150); setLocation(0, gui.getDesktopPane().getHeight() - 150); @@ -1198,9 +1193,11 @@ public class TimeLine extends VisPlugin { if (showWatchpoints) { h += EVENT_PIXEL_HEIGHT; } - paintedMoteHeight = h; - timelineMoteRuler.repaint(); - timeline.repaint(); + if (h != paintedMoteHeight) { + paintedMoteHeight = h; + timelineMoteRuler.repaint(); + timeline.repaint(); + } } public void closePlugin() {