+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
+ {\r
+ drawScale(g, av.getStartRes(), av.getEndRes(), getWidth(), getHeight());\r
+ }\r
+\r
+ // scalewidth will normally be screenwidth,\r
+ public void drawScale(Graphics g, int startx, int endx, int width,\r
+ int height)\r
+ {\r
+ Graphics2D gg = (Graphics2D) g;\r
+ gg.setFont(av.getFont());\r
+ gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
+\r
+ //Fill in the background\r
+ gg.setColor(Color.white);\r
+ gg.fillRect(0, 0, width, height);\r
+ gg.setColor(Color.black);\r
+\r
+ //Fill the selected columns\r
+ ColumnSelection cs = av.getColumnSelection();\r
+ gg.setColor(new Color(220, 0, 0));\r
+\r
+ for (int i = 0; i < cs.size(); i++)\r
+ {\r
+ int sel = cs.columnAt(i);\r
+\r
+ if ((sel >= startx) && (sel <= endx))\r
+ {\r
+ gg.fillRect((sel - startx) * av.charWidth, 0, av.charWidth,\r
+ getHeight());\r
+ }\r
+ }\r
+\r
+ // Draw the scale numbers\r
+ gg.setColor(Color.black);\r
+\r
+ int scalestartx = (startx / 10) * 10;\r
+\r
+ FontMetrics fm = gg.getFontMetrics(av.getFont());\r
+ int y = av.charHeight - fm.getDescent();\r
+\r
+ if ((scalestartx % 10) == 0)\r
+ {\r
+ scalestartx += 5;\r
+ }\r
+\r
+ for (int i = scalestartx; i < endx; i += 5)\r
+ {\r
+ if ((i % 10) == 0)\r
+ {\r
+ gg.drawString(String.valueOf(i),\r
+ (i - startx - 1) * av.charWidth, y);\r
+ gg.drawLine((int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + 2,\r
+ (int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
+ }\r
+ else\r
+ {\r
+ gg.drawLine((int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + fm.getDescent(),\r
+ (int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
+ }\r
+ }\r
+ }\r