(av.isShowAnnotation() && av
.getAlignmentConservationAnnotation() != null));
- // setSize(od.getWidth(), od.getHeight() + 20);
-
setLayout(new BorderLayout());
progressPanel = new ProgressPanel(OverviewRenderer.UPDATE,
- MessageManager.getString("label.oview_calc"));
+ MessageManager.getString("label.oview_calc"), getWidth());
this.add(progressPanel, BorderLayout.SOUTH);
oviewCanvas = new OverviewCanvas(od, av, progressPanel);
av.getRanges().addPropertyChangeListener(this);
+ // without this the overview window does not size to fit the overview canvas
+ setPreferredSize(new Dimension(od.getWidth(), od.getHeight()));
+
addComponentListener(new ComponentAdapter()
{
@Override
public void componentResized(ComponentEvent evt)
{
- updateOverviewImage();
+ // Resize is called on the initial display of the overview.
+ // This code adjusts sizes to account for the progress bar if it has not
+ // already been accounted for, which triggers another resize call for
+ // the correct sizing, at which point the overview image is updated.
+ // (This avoids a double recalculation of the image.)
+ if (getWidth() == od.getWidth() && getHeight() == od.getHeight()
+ + progressPanel.getHeight())
+ {
+ updateOverviewImage();
+ }
+ else
+ {
+ if ((getWidth() > 0) && (getHeight() > 0))
+ {
+ od.setWidth(getWidth());
+ od.setHeight(getHeight() - progressPanel.getHeight());
+ }
+
+ setPreferredSize(new Dimension(od.getWidth(),
+ od.getHeight() + progressPanel.getHeight()));
+ }
}
});
}
}
});
-
- setPreferredSize(new Dimension(od.getWidth(),
- od.getHeight()));
}
/*