X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FScaleCanvas.java;h=d70824897af563c3d3a65363aea96f02ee3622c5;hb=d4ede6b61d4abab78200f334d8df07879dfe6741;hp=4a0bd2a1da0851b68023ba52655e41f945a7fe7e;hpb=05d637d6b2e5aa0555f28f351b2d65001c9bcf09;p=jalview.git diff --git a/src/jalview/gui/ScaleCanvas.java b/src/jalview/gui/ScaleCanvas.java index 4a0bd2a..d708248 100755 --- a/src/jalview/gui/ScaleCanvas.java +++ b/src/jalview/gui/ScaleCanvas.java @@ -5,11 +5,6 @@ import javax.swing.*; public class ScaleCanvas extends JPanel { - Image img; - Graphics gg; - - int imgWidth; - int imgHeight; int xoffset; public static final int HEIGHT = 30; @@ -28,34 +23,17 @@ public class ScaleCanvas extends JPanel { } // scalewidth will normally be screenwidth, - public void drawScale(Graphics g, int startx, int endx, int scaleWidth) + public void drawScale(Graphics gg, int startx, int endx, int scaleWidth) { - double charWidth = av.getCharWidth(); - - if (img == null || - imgWidth != scaleWidth || - imgHeight != getHeight() || - paintFlag == true) { - - imgWidth = scaleWidth; - imgHeight = getHeight(); - img = createImage(imgWidth,imgHeight); - - gg = img.getGraphics(); - gg.setColor(Color.white); - gg.fillRect(0,0,imgWidth,imgHeight); + int charWidth = av.getCharWidth(); - - - paintFlag = false; - } gg.setFont(av.getFont()); //Fill in the background gg.setColor(Color.white); - gg.fillRect(0,0,imgWidth,imgHeight); + gg.fillRect(0,0,scaleWidth, HEIGHT); int resWidth = endx - startx + 1; @@ -88,7 +66,7 @@ public class ScaleCanvas extends JPanel { //Fill the selected columns ColumnSelection cs = av.getColumnSelection(); - int width = (int)charWidth; + int width = charWidth; if (width == 0) width = 1; @@ -98,7 +76,7 @@ public class ScaleCanvas extends JPanel { // System.out.println("Selection = " + sel); if ( sel >= startx && sel <= endx) { - gg.fillRect((int)((sel-startx)*charWidth),0,width,getHeight()); + gg.fillRect((sel-startx)*charWidth,0,width,getHeight()); } } @@ -110,14 +88,12 @@ public class ScaleCanvas extends JPanel { String string = String.valueOf(i); - gg.drawString(string,(int)((i-startx-1)*charWidth),15); + gg.drawString(string,(i-startx-1)*charWidth,15); gg.drawLine( (int)((i-startx-1)*charWidth +charWidth/2), 17, (int)((i-startx-1)*charWidth +charWidth/2), 24); } - g.drawImage(img,0,0,this); - } public Dimension getMinimumSize() {