Java Genesis

Hints for Chapter 2: Exploring Java

Problem 1: modifying the draw-circle code


The class DrawCircleFrame has the responsibility for determining the position and size of the window. To be more specific, Modify the values of these variables to be integers other than the ones given in the original code and notice how the position and size of the window changes when the class is recompiled and the DrawCircle class re-run.

Notice how helpful it was to have meaningful names such as xWindow, height, etc. These names suggest to us the role played by the respective values and greatly help us understand the code. This is something to keep in mind when we write our own code!

Now try modifying the position, size and colour of the circle before looking at the next hint.


Next Hint