我正在制作一个 class 以使用 class 在随机位置绘制一个矩形,我得到错误找不到符号
I am making a class to draw a rectangle in random locations using a class to do it, I get the error cannot find symbol
public void draw(Canvas canvas, int canvasHeight)
{
drawRectangle(10,10,10,10);
}
我知道我不能添加
public void drawRectangle
现在我完全卡住了,有什么想法吗?
error cannot find symbol
表示没有名为 drawRectangle
的方法,因此您应该创建一个。
您可以添加:
public void drawRectangle(int x1, int y1, int x2, int y2) {
//your implementation of drawing rectangle here
}
public void draw(Canvas canvas, int canvasHeight)
{
drawRectangle(10,10,10,10);
}
我知道我不能添加
public void drawRectangle
现在我完全卡住了,有什么想法吗?
error cannot find symbol
表示没有名为 drawRectangle
的方法,因此您应该创建一个。
您可以添加:
public void drawRectangle(int x1, int y1, int x2, int y2) {
//your implementation of drawing rectangle here
}