public class Square extends Shape
DEFAULT_COLOR
Constructor and Description |
---|
Square(double x,
double y,
double s)
Creates a square centered at the given coordinates with
the given side length and default color.
|
Square(Point cen,
double s)
Creates a square centered at the given point with
the given side length and default color.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Point point)
Determines if this square contains the given point.
|
void |
draw(android.graphics.Canvas canvas)
Draws this square on the given canvas.
|
Point |
getCenter()
Returns the center of this rectangle.
|
int |
getColor()
Returns the color of this square.
|
double |
getSide()
Returns the length of the side of this square.
|
void |
move(double dx,
double dy)
Moves this square by the given displacement.
|
void |
setColor(int color)
Changes the color of this square.
|
public Square(double x, double y, double s)
x
- the x-coordinate of the rectangle centery
- the y-coordinate of the rectangle centers
- the side the rectanglepublic Square(Point cen, double s)
cen
- the center of the squares
- the side the squarepublic boolean contains(Point point)
public void draw(android.graphics.Canvas canvas)
public Point getCenter()
public int getColor()
public double getSide()
public void move(double dx, double dy)