Code: Select all
@Override
public void mouseDragged(final MouseEvent event) {
...
double mouseX = event.getX();
double mouseY = event.getY();
double zoomX;
double zoomY;
double zoomWidth;
double zoomHeight;
if (mouseX > zoomPoint.getX()) {
zoomX = this.zoomPoint.getX();
zoomWidth = Math.min(mouseX, scaledDataArea.getMaxX()) - this.zoomPoint.getX();
} else {
mouseX = Math.max(mouseX, scaledDataArea.getMinX());
zoomX = mouseX;
zoomWidth = this.zoomPoint.getX() - mouseX;
}
if (mouseY > zoomPoint.getY()) {
zoomY = this.zoomPoint.getY();
zoomHeight = Math.min(mouseY, scaledDataArea.getMaxY()) - this.zoomPoint.getY();
} else {
mouseY = Math.max(mouseY, scaledDataArea.getMinY());
zoomY = mouseY;
zoomHeight = this.zoomPoint.getY() - mouseY;
}
this.zoomRectangle = new Rectangle2D.Double(zoomX, zoomY, zoomWidth, zoomHeight);
...
Instead of looking like this (translucent blue):
It looks like this (dark grey):
The drawZoomRectangle() function is the same in my extended class. I think the problem may have to do with using setXORMode() in drawZoomRectangle() but I'm not sure. Any ideas?