X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationLabels.java;h=dcdccc525c9103dc5c77698b31402e8b1adb167c;hb=a28c9340eeadfdaa551a21b9dea1d0f1530126e3;hp=ca5fe23edce4dd9334775ef6f9bd8dabec62cf3c;hpb=218ff56e061f1329f53b2fa4cb353b0348a87bc0;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index ca5fe23..dcdccc5 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -29,6 +29,7 @@ public class AnnotationLabels { boolean active = false; AlignmentPanel ap; + AlignViewport av; boolean resizing = false; int oldY, mouseX; static String ADDNEW = "Add new row"; @@ -42,6 +43,7 @@ public class AnnotationLabels public AnnotationLabels(AlignmentPanel ap) { this.ap = ap; + this.av = ap.av; setLayout(null); addMouseListener(new MouseAdapter() { @@ -52,6 +54,12 @@ public class AnnotationLabels }); } + public AnnotationLabels(AlignViewport av) +{ + this.av = av; +} + + public void setScrollOffset(int y) { scrollOffset = y; @@ -60,7 +68,7 @@ public class AnnotationLabels public void actionPerformed(ActionEvent evt) { - AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation(); + AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); if (evt.getActionCommand().equals(HIDE)) { @@ -75,7 +83,7 @@ public class AnnotationLabels } else if (evt.getActionCommand().equals(OUTPUT_TEXT)) { - CutAndPasteTransfer cap = new CutAndPasteTransfer(false); + CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame.applet); Frame frame = new Frame(); frame.add(cap); jalview.bin.JalviewLite.addFrame(frame, @@ -146,11 +154,16 @@ public class AnnotationLabels public void paint(Graphics g) { - drawComponent(g); + drawComponent(g, getSize().width); } - public void drawComponent(Graphics g) + public void drawComponent(Graphics g, int width) { + if (!jalview.bin.JalviewLite.AWT1) + { + MyGraphics.AntiAlias(g); + } + FontMetrics fm = g.getFontMetrics(g.getFont()); g.setColor(Color.white); g.fillRect(0, 0, getSize().width, getSize().height); @@ -158,7 +171,7 @@ public class AnnotationLabels g.translate(0, scrollOffset); g.setColor(Color.black); - AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation(); + AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); int y = g.getFont().getSize(); int x = 0; @@ -171,7 +184,7 @@ public class AnnotationLabels continue; } - x = getSize().width - fm.stringWidth(aa[i].label) - 3; + x = width - fm.stringWidth(aa[i].label) - 3; if (aa[i].isGraph) {