check dispalyChar is not null
authoramwaterhouse <Andrew Waterhouse>
Mon, 23 Apr 2007 11:47:47 +0000 (11:47 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 23 Apr 2007 11:47:47 +0000 (11:47 +0000)
src/jalview/gui/AnnotationPanel.java

index 2f444d6..c9fa597 100755 (executable)
@@ -821,15 +821,20 @@ public class AnnotationPanel
           }\r
         }\r
 \r
-        if (av.validCharWidth && validRes &&\r
-            (row.annotations[column].displayCharacter.length() > 0))\r
+        if (av.validCharWidth && validRes\r
+            && row.annotations[column].displayCharacter != null\r
+            && (row.annotations[column].displayCharacter.length() > 0))\r
         {\r
 \r
           int charOffset = (av.charWidth -\r
                             fm.charWidth(row.annotations[column].\r
                                          displayCharacter.charAt(\r
                                              0))) / 2;\r
-          g.setColor(row.annotations[column].colour);\r
+\r
+          if (row.annotations[column].colour == null)\r
+            g.setColor(Color.black);\r
+          else\r
+            g.setColor(row.annotations[column].colour);\r
 \r
           if (column == 0 || row.graph > 0)\r
           {\r
@@ -1143,7 +1148,11 @@ public class AnnotationPanel
         continue;\r
       }\r
 \r
-      g.setColor(aa.annotations[column].colour);\r
+      if (aa.annotations[column].colour == null)\r
+        g.setColor(Color.black);\r
+      else\r
+        g.setColor(aa.annotations[column].colour);\r
+\r
       y1 = y -\r
           (int) ( ( (aa.annotations[column - 1].value - min) / range) * graphHeight);\r
       y2 = y -\r
@@ -1217,7 +1226,11 @@ public class AnnotationPanel
         continue;\r
       }\r
 \r
-      g.setColor(aa.annotations[column].colour);\r
+      if (aa.annotations[column].colour == null)\r
+        g.setColor(Color.black);\r
+      else\r
+        g.setColor(aa.annotations[column].colour);\r
+\r
       y1 = y -\r
           (int) ( ( (aa.annotations[column].value - min) / (range)) * aa.graphHeight);\r
 \r
@@ -1264,7 +1277,10 @@ public class AnnotationPanel
     {\r
       if (aa.annotations[j] != null)\r
       {\r
-        g.setColor(aa.annotations[j].colour);\r
+        if (aa.annotations[j].colour == null)\r
+          g.setColor(Color.black);\r
+        else\r
+          g.setColor(aa.annotations[j].colour);\r
 \r
         height = (int) ( (aa.annotations[j].value / aa.graphMax) * y);\r
         if (height > y)\r