From 6bb926966b1deea4c08de080355b4f6bbabf1f4f Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 29 Jan 2007 17:41:31 +0000 Subject: [PATCH] Image for labels, stops flickering --- src/jalview/appletgui/AnnotationLabels.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 5150867..48cea13 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -28,6 +28,7 @@ import jalview.datamodel.*; public class AnnotationLabels extends Panel implements ActionListener, MouseListener, MouseMotionListener { + Image image; boolean active = false; AlignmentPanel ap; AlignViewport av; @@ -232,9 +233,21 @@ public class AnnotationLabels } } + public void update(Graphics g) + { + paint(g); + } + public void paint(Graphics g) { - drawComponent(g, getSize().width); + int w = getSize().width; + if (image == null || w != image.getWidth(this)) + { + image = createImage(w, ap.annotationPanel.getSize().height); + } + + drawComponent(image.getGraphics(), w); + g.drawImage(image,0,0,this); } public void drawComponent(Graphics g, int width) -- 1.7.10.2