Say I have a java.awt.Rectangle
set up as:
x - - - - - - -
| - - - - - - - |
| - - - - - - - |
| - - - - - - - |
| - - - y - - - |
| - - - - - - - |
| - - - - - - - |
- - - - - - - - -
Does getX()
return the x-coordinate of x
or y
?
getX()
returns the top-left x-coordinate.
The source says it all:
Looking at the Rectangle(x, y, width, height)
constructor:
public Rectangle(int x, int y, int width, int height) {
this.x = x;
...
}
The docs for the above says:
Constructs a new Rectangle whose upper-left corner is specified as (x,y)
Looking at getX()
:
public double getX() {
return x;
}