类 Rectangle
java.lang.Object
com.example.graphics.model.Rectangle
- 所有已实现的接口:
Shape
Rectangle implementation of the Shape interface.
-
字段概要
字段 -
构造器概要
构造器构造器说明Rectangle
(int x, int y, int width, int height) Constructs a rectangle with the specified parameters -
方法概要
修饰符和类型方法说明void
accept
(ShapeVisitor visitor) Accept method for the Visitor patternclone()
Clone the shapeint
Get the height of the rectangleint
getWidth()
Get the width of the rectangleint
getX()
Get the x coordinate of the shapeint
getY()
Get the y coordinate of the shapevoid
setHeight
(int height) Set the height of the rectanglevoid
setPosition
(int x, int y) Set the position of the shapevoid
setSize
(int width, int height) Set both width and height of the rectangle at oncevoid
setWidth
(int width) Set the width of the rectangle
-
字段详细资料
-
x
private int x -
y
private int y -
width
private int width -
height
private int height
-
-
构造器详细资料
-
Rectangle
public Rectangle(int x, int y, int width, int height) Constructs a rectangle with the specified parameters- 参数:
x
- the x coordinate of the top-left cornery
- the y coordinate of the top-left cornerwidth
- the width of the rectangleheight
- the height of the rectangle
-
-
方法详细资料
-
getX
public int getX()从接口复制的说明:Shape
Get the x coordinate of the shape -
getY
public int getY()从接口复制的说明:Shape
Get the y coordinate of the shape -
setPosition
public void setPosition(int x, int y) 从接口复制的说明:Shape
Set the position of the shape- 指定者:
setPosition
在接口中Shape
- 参数:
x
- the x coordinatey
- the y coordinate
-
getWidth
public int getWidth()Get the width of the rectangle- 返回:
- the width
-
setWidth
public void setWidth(int width) Set the width of the rectangle- 参数:
width
- the new width
-
getHeight
public int getHeight()Get the height of the rectangle- 返回:
- the height
-
setHeight
public void setHeight(int height) Set the height of the rectangle- 参数:
height
- the new height
-
setSize
public void setSize(int width, int height) Set both width and height of the rectangle at once- 参数:
width
- the new widthheight
- the new height
-
accept
从接口复制的说明:Shape
Accept method for the Visitor pattern -
clone
从接口复制的说明:Shape
Clone the shape
-