package freegraph; import java.awt.*; import java.awt.image.*; /** * InvertRectangle is used to draw the zoom rectangle of GraphPlane. It was * originally introduced to work around a stange drawing bug in some old VMs * with setXORMode(). However that is fixed, so the work around has been * removed, but the class still exists. */ class InvertRectangle { public InvertRectangle() { } /** * draws an inverted rectangle on the Graphics object */ public void drawRect(Graphics graphics, int x1, int y1, int width, int height) { if (width < 0) { x1 = x1 + width; width = Math.abs(width); } if (height < 0) { y1 = y1 + height; height = Math.abs(height); } graphics.setColor(Color.black); graphics.setXORMode(Color.white); graphics.drawRect(x1, y1, width, height); graphics.setPaintMode(); } }