I'm doing an assignment. This is the first part of the assignment:
Drawing a single brick
These are the steps to draw a brick:
Construct a new Rectangle object.
Set the position of your rectangle according to the coordinates that were passed in as parameters.
Change the size of the rectangle to be the proper size of a brick. There are two fields defined for you, one is called bWidth and the other is called bHeight and these are initialised wth values already as the width and height of a brick.
Note: Do not change the values of bWidth or bHeight in this task. Leave them as they are. (bWidth = 54) (bHeight = 16)
Add the rectangle to the ArrayList called bricks using the add method.
Last of all, make the rectangle visible
This is my current code:
private void drawBrick(int startX, int startY){
Rectangle brick1 = new Rectangle();
startX = 54;
startY = 16;
brick1.setPosition(startX, startY);
bricks = new ArrayList<Rectangle>();
bricks.add(brick1);
brick1.makeVisible();
}
But everytime I construct the object and call the draw method, nothing appears. What did I do wrong?