\r
public class ScaleCanvas extends JPanel {\r
\r
- Image img;\r
- Graphics gg;\r
-\r
- int imgWidth;\r
- int imgHeight;\r
int xoffset;\r
\r
public static final int HEIGHT = 30;\r
}\r
\r
// scalewidth will normally be screenwidth,\r
- public void drawScale(Graphics g, int startx, int endx, int scaleWidth)\r
+ public void drawScale(Graphics gg, int startx, int endx, int scaleWidth)\r
{\r
\r
- double charWidth = av.getCharWidth();\r
-\r
- if (img == null ||\r
- imgWidth != scaleWidth ||\r
- imgHeight != getHeight() ||\r
- paintFlag == true) {\r
-\r
- imgWidth = scaleWidth;\r
- imgHeight = getHeight();\r
- img = createImage(imgWidth,imgHeight);\r
-\r
- gg = img.getGraphics();\r
- gg.setColor(Color.white);\r
- gg.fillRect(0,0,imgWidth,imgHeight);\r
+ int charWidth = av.getCharWidth();\r
\r
-\r
-\r
- paintFlag = false;\r
- }\r
gg.setFont(av.getFont());\r
\r
//Fill in the background\r
\r
gg.setColor(Color.white);\r
- gg.fillRect(0,0,imgWidth,imgHeight);\r
+ gg.fillRect(0,0,scaleWidth, HEIGHT);\r
\r
int resWidth = endx - startx + 1;\r
\r
\r
//Fill the selected columns\r
ColumnSelection cs = av.getColumnSelection();\r
- int width = (int)charWidth;\r
+ int width = charWidth;\r
if (width == 0)\r
width = 1;\r
\r
// System.out.println("Selection = " + sel);\r
if ( sel >= startx && sel <= endx) {\r
\r
- gg.fillRect((int)((sel-startx)*charWidth),0,width,getHeight());\r
+ gg.fillRect((sel-startx)*charWidth,0,width,getHeight());\r
}\r
}\r
\r
\r
String string = String.valueOf(i);\r
\r
- gg.drawString(string,(int)((i-startx-1)*charWidth),15);\r
+ gg.drawString(string,(i-startx-1)*charWidth,15);\r
gg.drawLine( (int)((i-startx-1)*charWidth +charWidth/2), 17, (int)((i-startx-1)*charWidth +charWidth/2), 24);\r
\r
}\r
\r
\r
- g.drawImage(img,0,0,this);\r
-\r
}\r
\r
public Dimension getMinimumSize() {\r