Skip to main content

Another ShapePainter bug?

No replies
Anonymous

OK, maybe I'm misunderstanding how these things are supposed to work,
but I don't believe ShapePainter is really honoring its resizeLocation
flag. Take a look at this code from ShapePainter's paintBackground method:

//handle the location
Point2D location = getLocation();
Resize resizeLocation = getResizeLocation();
double x = location.getX();
double y = location.getY();
if (resizeLocation == Resize.HORIZONTAL || resizeLocation ==
Resize.BOTH) {
x = x * component.getWidth();
}
if (resizeLocation == Resize.VERTICAL || resizeLocation ==
Resize.BOTH) {
y = y * component.getHeight();
}
g.translate(-location.getX(), -location.getY());

Notice how it goes through all the trouble of setting up x and y, and
then doesn't use them! Instead it calls g.translate(...) with
location.getX() and location.getY(), which means, of course, that the
location is ultimately not resized.

- Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net