av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
}
graphStretchY = evt.getY();
- adjustPanelHeight();
+ calcPanelHeight();
needValidating = true;
ap.paintAlignment(true);
}
public int adjustPanelHeight(boolean repaint)
{
-
+ int height = calcPanelHeight();
+ this.setSize(new Dimension(getSize().width, height));
+ if (repaint)
+ {
+ repaint();
+ }
+ return height;
+ }
+ /**
+ * calculate the height for visible annotation, revalidating bounds where necessary
+ * ABSTRACT GUI METHOD
+ * @return total height of annotation
+ */
+ public int calcPanelHeight()
+ {
// setHeight of panels
AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
int height = 0;
{
height = 20;
}
- this.setSize(new Dimension(getSize().width, height));
- if (repaint)
- {
- repaint();
- }
return height;
public void paint(Graphics g)
{
-
- imgWidth = getSize().width;
+ Dimension d = getSize();
+ imgWidth = d.width;
// (av.endRes - av.startRes + 1) * av.charWidth;
-
+ if (imgWidth<1 || d.height<1)
+ {
+ return;
+ }
if (image == null || imgWidth != image.getWidth(this))
{
- image = createImage(imgWidth, ap.annotationPanel.getSize().height);
+ image = createImage(imgWidth, d.height);
gg = image.getGraphics();
gg.setFont(av.getFont());
fm = gg.getFontMetrics();