rectangle.getBounds().setLocation(shapeLocation) which doesn't work

I think this is the source of your misunderstanding (that snippet of
code was never intended to work) which you found out later in the thread
you linked in:

which is where my misunderstanding started from, also on this post-
http://forums.java.net/jive/thread.jspa?messageID=228037

Basically, to modify the Shape you need to invoke a method on the
original object.  The Shape interface only includes methods to ask for
information about the Shape, not to modify the Shape.  Even methods like
getBounds which return an object are not meant to provide an indirect
means to modify the object - the returned object is only an
encapsulation of an answer that could not be expressed using a simple
java type like an int or a boolean.

The fact that some of the objects used as return values for these
methods have methods of their own that make them mutable is a by-product
of the fact that those objects have a life other than to be used as a
return value.  In other words, a Rectangle object is useful in many
circumstances in which you might want to move them around - but in the
case of the return value of getBounds(), it is only being used to house
4 numbers in a convenient and recognizable way...

                       ...jim

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to