From: amwaterhouse Date: Tue, 20 Sep 2005 13:21:39 +0000 (+0000) Subject: Checks end of sequence before drawing text X-Git-Tag: Release_2_06~33 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4377073e4bb83612169bf0565e1561b872b069e6;p=jalview.git Checks end of sequence before drawing text --- diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 9a722f2..c413588 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -87,27 +87,24 @@ public class SequenceRenderer int curWidth = width; Color tempColour = null; - while (i <= end && i < length) + while (i <= end) { - if (inCurrentSequenceGroup(i)) + resBoxColour = Color.white; + if(i < length) { - if (currentSequenceGroup.getDisplayBoxes()) + if (inCurrentSequenceGroup(i)) { - getBoxColour(currentSequenceGroup.cs, seq, i); + if (currentSequenceGroup.getDisplayBoxes()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + } } - else + else if (av.getShowBoxes()) { - resBoxColour = Color.white; + getBoxColour(av.getGlobalColourScheme(), seq, i); } } - else if (av.getShowBoxes()) - { - getBoxColour(av.getGlobalColourScheme(), seq, i); - } - else - { - resBoxColour = Color.white; - } + if (resBoxColour != tempColour) { @@ -139,21 +136,19 @@ public class SequenceRenderer { int pady = height / 5; int charOffset = 0; - char s; + char s=' '; // Need to find the sequence position here. String sequence = seq.getSequence(); + + if(end+1>=seq.getLength()) + end = seq.getLength()-1; + for (int i = start; i <= end; i++) { graphics.setColor(Color.black); - if (i < sequence.length()) - { - s = sequence.charAt(i); - } - else - { - s = ' '; - } + + s = sequence.charAt(i); if (!renderGaps && jalview.util.Comparison.isGap(s)) { diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index e36160a..81daef7 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -144,28 +144,26 @@ public class SequenceRenderer Color tempColour = null; - while ((i <= end) && (i < length)) + while (i <= end) { + resBoxColour = Color.white; + + if (i < length) + { if (inCurrentSequenceGroup(i)) { - if (currentSequenceGroup.getDisplayBoxes()) - { - getBoxColour(currentSequenceGroup.cs, seq, i); - } - else - { - resBoxColour = Color.white; - } + if (currentSequenceGroup.getDisplayBoxes()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + } } else if (av.getShowBoxes()) { - getBoxColour(av.getGlobalColourScheme(), seq, i); - } - else - { - resBoxColour = Color.white; + getBoxColour(av.getGlobalColourScheme(), seq, i); } + } + if (resBoxColour != tempColour) { if (tempColour != null) @@ -213,18 +211,14 @@ public class SequenceRenderer // Need to find the sequence position here. String sequence = seq.getSequence(); + if(end+1>=seq.getLength()) + end = seq.getLength()-1; + for (int i = start; i <= end; i++) { graphics.setColor(Color.black); - if (i < sequence.length()) - { - s = sequence.charAt(i); - } - else - { - s = ' '; - } + s = sequence.charAt(i); if (!renderGaps && jalview.util.Comparison.isGap(s)) {