X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=1574d0350772b2e8882ebb5f29efbbd05d8155b5;hb=237972562c84b83dbd287071cdd839d97aaf7d4b;hp=12ae05c625e7efe384ac354f90c9e539a74155c0;hpb=b43cedc0630eb10f2414ba940b075c9467bcb3b5;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 12ae05c..1574d03 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -714,18 +714,19 @@ public class AlignmentPanel extends GAlignmentPanel pg.setFont(new Font(av.getFont().getName(), Font.ITALIC, av.getFont().getSize())); + SequenceI seq; for (int i = startSeq; i < endSeq; i++) { + seq = av.getAlignment().getSequenceAt(i); if ( (av.getSelectionGroup() != null) && - av.getSelectionGroup().getSequences(false).contains( - av.getAlignment().getSequenceAt(i))) + av.getSelectionGroup().getSequences(false).contains(seq)) { currentColor = Color.gray; currentTextColor = Color.black; } else { - currentColor = av.getAlignment().getSequenceAt(i).getColor(); + currentColor = av.getSequenceColour(seq); currentTextColor = Color.black; } @@ -735,10 +736,17 @@ public class AlignmentPanel extends GAlignmentPanel pg.setColor(currentTextColor); - String string = av.getAlignment().getSequenceAt(i).getDisplayId - ( av.getShowJVSuffix()); + int xPos = 0; + if (av.rightAlignIds) + { + fm = pg.getFontMetrics(); + xPos = idWidth - fm.stringWidth( + seq.getDisplayId(av.getShowJVSuffix()) + ) - 4; + } - pg.drawString(string, 0, + pg.drawString(seq.getDisplayId( av.getShowJVSuffix()), + xPos, ( ( (i - startSeq) * av.charHeight) + av.getCharHeight()) - (av.getCharHeight() / 5)); } @@ -829,8 +837,13 @@ public class AlignmentPanel extends GAlignmentPanel { SequenceI s = av.alignment.getSequenceAt(i); String string = s.getDisplayId( av.getShowJVSuffix()); - - pg.drawString(string, 0, + int xPos = 0; + if (av.rightAlignIds) + { + FontMetrics fm = getFontMetrics(italic); + xPos = idWidth - fm.stringWidth( string ) - 4; + } + pg.drawString(string, xPos, ( (i * av.charHeight) + ypos + av.charHeight) - (av.charHeight / 5)); }