Middle mouse to compress alignment
[jalview.git] / src / jalview / appletgui / AnnotationPanel.java
index daa68d1..1bf3d38 100755 (executable)
@@ -60,7 +60,7 @@ public class AnnotationPanel
 \r
     this.ap = ap;\r
     av = ap.av;\r
-    this.setLayout(null);\r
+    setLayout(null);\r
     adjustPanelHeight();\r
 \r
     addMouseMotionListener(new MouseMotionAdapter()\r
@@ -131,9 +131,6 @@ public class AnnotationPanel
     }\r
 \r
     this.setSize(getSize().width, height);\r
-    if(ap!=null)\r
-       ap.annotationScroller.setSize(getSize().width, height);\r
-\r
 \r
     repaint();\r
 \r
@@ -211,6 +208,8 @@ public class AnnotationPanel
 \r
   public void paint(Graphics g)\r
   {\r
+\r
+\r
     imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
 \r
     if (image == null || imgWidth != image.getWidth(this))\r
@@ -230,6 +229,8 @@ public class AnnotationPanel
     }\r
 \r
     drawComponent(gg, av.startRes, av.endRes + 1);\r
+    g.setColor(Color.white);\r
+    g.fillRect(0, 0, getSize().width, getSize().height);\r
     g.drawImage(image, 0, 0, this);\r
   }\r
 \r
@@ -291,14 +292,14 @@ public class AnnotationPanel
           g.setColor(Color.white);\r
           g.fillRect(0, 0, getSize().width, getSize().height);\r
           g.setColor(Color.black);\r
-          g.drawString("Alignment has no annotations", 20, 15);\r
+          if(av.validCharWidth)\r
+            g.drawString("Alignment has no annotations", 20, 15);\r
 \r
           return;\r
       }\r
 \r
       AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
 \r
-      int j;\r
       int x = 0;\r
       int y = 0;\r
       char lastSS;\r
@@ -361,8 +362,8 @@ public class AnnotationPanel
               x = (column - startRes) * av.charWidth;\r
 \r
 \r
-              if (validRes &&\r
-                      (row.annotations[column].displayCharacter.length() > 0))\r
+              if (av.validCharWidth && validRes &&\r
+                        (row.annotations[column].displayCharacter.length() > 0))\r
               {\r
                 int charOffset = (av.charWidth -\r
                     fm.charWidth(row.annotations[column].displayCharacter.charAt(\r