Deferred mote height calculation until components are initialized

This commit is contained in:
Niclas Finne 2012-03-06 12:47:53 +01:00
parent 99f3d5ada2
commit 5288ac12b5

View File

@ -229,12 +229,6 @@ public class TimeLine extends VisPlugin {
}); });
eventCheckboxes.add(eventCheckBox); eventCheckboxes.add(eventCheckBox);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
recalculateMoteHeight();
}
});
/* Panel: timeline canvas w. scroll pane and add mote button */ /* Panel: timeline canvas w. scroll pane and add mote button */
timeline = new Timeline(); timeline = new Timeline();
timelineScrollPane = new JScrollPane( timelineScrollPane = new JScrollPane(
@ -268,6 +262,7 @@ public class TimeLine extends VisPlugin {
getContentPane().add(splitPane); getContentPane().add(splitPane);
recalculateMoteHeight();
pack(); pack();
setSize(gui.getDesktopPane().getWidth(), 150); setSize(gui.getDesktopPane().getWidth(), 150);
setLocation(0, gui.getDesktopPane().getHeight() - 150); setLocation(0, gui.getDesktopPane().getHeight() - 150);
@ -1198,9 +1193,11 @@ public class TimeLine extends VisPlugin {
if (showWatchpoints) { if (showWatchpoints) {
h += EVENT_PIXEL_HEIGHT; h += EVENT_PIXEL_HEIGHT;
} }
paintedMoteHeight = h; if (h != paintedMoteHeight) {
timelineMoteRuler.repaint(); paintedMoteHeight = h;
timeline.repaint(); timelineMoteRuler.repaint();
timeline.repaint();
}
} }
public void closePlugin() { public void closePlugin() {