\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
-\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
\r
\r
- g.drawImage(img,0,0,this);\r
-\r
}\r
\r
public Dimension getMinimumSize() {\r