Tino APCS

Putting it all together

Now that we have a complete Window class with attributes and setter methods, let's use it to create window objects in our program's main() method

public class House {

    public static void main(String[] args) {

        SketchPad paper = new SketchPad(1000, 1000, 50);    // Declare and initialize a SketchPad object named paper
        DrawingTool pen = new DrawingTool(paper);           // Declare and initialize a DrawingTool object named pen

        pen.setWidth(3);
        pen.drawRect(600, 400);                     // Draw basic house body

        Window win1 = new Window(-200, 0, paper);     // Left window
        win1.setDimensions(100, 100);
        win1.setInteriorColor(Color.YELLOW);
        win1.draw();

        Window win2 = new Window(200, 0, paper);      // Right window
        win2.setDimensions(100, 100);
        Color lightBlue = new Color(200, 255, 255);
        win2.setInteriorColor(lightBlue);
        win2.draw();       
    }
}


Here's the result:

Dark Mode

Outline