At 4/4/16 09:24 PM, Barzona wrote:
As it turns out, the getBounds() method returns a Rectangle value, so I just took the width of that rectangle.
Yeah, the getBounds() method wouldn't really work otherwise: it needs to take into account the relative x/y coordinates, as well as the dimensions of the bounds (such as the aforementioned width). It is really just a virtual rectangle surrounding the contents of the object.
It's worth reading the docs on the getBounds() function to ensure an understanding of what it's doing, but it's pretty straightforward: it returns the dimensions of the contents, including any stroke styles that may adjust them, and sets the x/y coordinates relative to the object passed to it (i.e. the x/y coordinates are set to the position of the calling object's position within the passed object, ignoring the passed object's position in its parent, should such a parent exist).
Having said that, from the looks of it, you should just be able to use the width() and height() methods.
At 4/4/16 09:13 PM, Barzona wrote:
In the past, I've only ever dealt with functions that return a single value.
To be pedantic: It still is just returning a single value (i.e. a Rectangle object). The returned object just has four public members, which could be interpreted as "four values."