X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=d97c80f78a0c5f0714f119bf97a9f067932ab88a;hb=f85c8c88d6947b9f290409f1271429144df2c120;hp=aeb0b9a0cbd92572d708cd6af5608b58c7f92f3d;hpb=7720c1e94b0b88c9be05becae787078f152d8c5b;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index aeb0b9a..d97c80f 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -76,6 +76,12 @@ public class AnnotationPanel extends JPanel implements MouseListener, ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this); } + public AnnotationPanel(AlignViewport av) + { + this.av = av; + } + + /** * DOCUMENT ME! * @@ -89,7 +95,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, /** * DOCUMENT ME! */ - public void adjustPanelHeight() + public int adjustPanelHeight() { // setHeight of panels image = null; @@ -136,6 +142,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, } this.setPreferredSize(new Dimension(1, height)); + + return height; } /** @@ -148,6 +156,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, if (activeRow == -1) { AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + if(aa==null) + return; for (int j = 0; j < aa.length; j++) { @@ -178,6 +188,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, if (activeRow == -1) { AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + if(aa==null) + return; for (int j = 0; j < aa.length; j++) { @@ -526,7 +538,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); - if (fastPaint) + if (fastPaint && image!=null) { g.drawImage(image, 0, 0, this); fastPaint = false; @@ -602,8 +614,14 @@ public class AnnotationPanel extends JPanel implements MouseListener, * @param startRes DOCUMENT ME! * @param endRes DOCUMENT ME! */ - public void drawComponent(Graphics2D g, int startRes, int endRes) + public void drawComponent(Graphics g, int startRes, int endRes) { + g.setFont(av.getFont()); + + if (fm == null) + fm = g.getFontMetrics(); + + g.setColor(Color.white); g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());