# Getting the Dimensions of a Breadboard's Canvas

The dimensions of the canvas (the central drawing area of a breadboard window) are slightly smaller than the dimensions of the breadboard window itself. In particular, one must subtract from the height of the breadboard window both the height of the top (i.e., NORTH) portion of the window where a text area can be found, and the height of the bottom (i.e., SOUTH) portion of the window where the text field and button(s) can be found.

With this in mind, note that one can get the width and height of the canvas by using something similar to the following code -- which places a pink rectangle so that it exactly fills this central drawing area. (When you run this program, you can test that claim by dragging the corner of the window to expand it. You will see the pink rectangle doesn't extend past the original size of the canvas.)


import java.awt.Color;

import acm.graphics.GRect;

public void run() {
this.setSize(500,500);