only set graphics black once at beginning of text
authoramwaterhouse <Andrew Waterhouse>
Tue, 8 Mar 2005 14:34:10 +0000 (14:34 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 8 Mar 2005 14:34:10 +0000 (14:34 +0000)
src/jalview/gui/SequenceRenderer.java

index 69db54d..5b5a392 100755 (executable)
@@ -98,17 +98,19 @@ public class SequenceRenderer implements RendererI
     int charOffset=0;\r
     char s;\r
     // Need to find the sequence position here.\r
+\r
+    graphics.setColor(Color.black);\r
+    String sequence  = seq.getSequence();\r
     for (int i = start; i <= end; i++)\r
     {\r
-        if(i<seq.getLength())\r
-          s = seq.getSequence().charAt(i);\r
+        if(i<sequence.length())\r
+          s = sequence.charAt(i);\r
         else\r
           s = ' ';\r
 \r
         if(!renderGaps && jalview.util.Comparison.isGap(s))\r
           continue;\r
 \r
-        graphics.setColor(Color.black);\r
 \r
         if (inCurrentSequenceGroup(i))\r
         {\r
@@ -133,9 +135,11 @@ public class SequenceRenderer implements RendererI
            }\r
         }\r
 \r
-      charOffset =  (width - fm.charWidth(s))/2;\r
-      graphics.drawString(String.valueOf(s), charOffset + x1 + width * (i - start), y1 + height - pady);\r
-    }\r
+          charOffset =  (width - fm.charWidth(s))/2;\r
+          graphics.drawString(String.valueOf(s),\r
+                              charOffset + x1 + width * (i - start),\r
+                              y1 + height - pady);\r
+        }\r
 \r
 \r
   }\r
@@ -170,7 +174,7 @@ public class SequenceRenderer implements RendererI
        if(i<seq.getLength())\r
           s = seq.getSequence().charAt(i);\r
 \r
-      charOffset =  (width - fm.charWidth(s))/2;\r
+     charOffset =  (width - fm.charWidth(s))/2;\r
       graphics.drawString(String.valueOf(s), charOffset + x1 + width * (i - start), y1 + height - pady);\r
     }\r
   }\r