/** Overrides <code>Graphics.copyArea</code>. */ public void copyArea(int x, int y, int width, int height, int destX, int destY) { if (debugLog()) { info() .log( toShortString() + " Copying area from: " + new Rectangle(x, y, width, height) + " to: " + new Point(destX, destY)); } graphics.copyArea(x, y, width, height, destX, destY); }
public void update(double slowdown, double arrival) { freeway.update(slowdown, arrival); if (buffer == null) { xsize = size().width; ysize = size().height; buffer = createImage(xsize, ysize); } Graphics bg = buffer.getGraphics(); freeway.paint(bg, row, XDOTDIST, DOTSIZE); if (row < ysize - 2 * DOTSIZE + 1) row += DOTSIZE; else { bg.copyArea(0, DOTSIZE, xsize, ysize - DOTSIZE, 0, -DOTSIZE); bg.clearRect(0, ysize - DOTSIZE, xsize, DOTSIZE); } bg.dispose(); repaint(); }