X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationLabels.java;h=8561e640b1020c397f1d26d5ad2771ba024cd3da;hb=5aeb9ce3b99be8cbe7ca47c04a31dca3e3bbc282;hp=c21f370d9649d5045ee740e2b68ac090fe7ebf7a;hpb=d65fda1b7cee986dadd46083e25bdd274f3055df;p=jalview.git diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index c21f370..8561e64 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -44,12 +44,14 @@ public class AnnotationLabels extends JPanel implements MouseListener, boolean active = false; Image image; AlignmentPanel ap; + AlignViewport av; boolean resizing = false; int oldY; int mouseX; int selectedRow = 0; int scrollOffset = 0; + /** * Creates a new AnnotationLabels object. * @@ -58,6 +60,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, public AnnotationLabels(AlignmentPanel ap) { this.ap = ap; + av = ap.av; java.net.URL url = getClass().getResource("/images/idwidth.gif"); Image temp = null; @@ -88,6 +91,11 @@ public class AnnotationLabels extends JPanel implements MouseListener, addMouseMotionListener(this); } + public AnnotationLabels(AlignViewport av) + { + this.av = av; + } + /** * DOCUMENT ME! * @@ -325,7 +333,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, { pop.addSeparator(); final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem( - "Ignore gaps in consensus", + "Ignore Gaps In Consensus", ap.av.getIgnoreGapsConsensus()); cbmi.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) @@ -346,13 +354,19 @@ public class AnnotationLabels extends JPanel implements MouseListener, * * @param g1 DOCUMENT ME! */ - public void paintComponent(Graphics g1) + public void paintComponent(Graphics g) { - Graphics2D g = (Graphics2D) g1; - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + + int width = getWidth(); + if(width==0) + width = ap.calculateIdWidth().width + 4; + + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - drawComponent(g); + drawComponent(g2, width); + } /** @@ -360,7 +374,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, * * @param g DOCUMENT ME! */ - public void drawComponent(Graphics2D g) + public void drawComponent(Graphics g, int width) { FontMetrics fm = g.getFontMetrics(g.getFont()); g.setColor(Color.white); @@ -369,12 +383,10 @@ public class AnnotationLabels extends JPanel implements MouseListener, 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; - int width = getWidth(); - if(width==0) - width = ap.calculateIdWidth().width + 4; + if (aa != null) {