Java Genesis

Problem 1: hint 2

The class DrawCirclePanel has the responsibility for determining the position, size and colour of the circle. To be more specific,

Modify the values of the variables xCentre, yCentre and rad to be integers other than the ones given in the original code and notice how the position and size of the circle changes when the class is recompiled and the DrawCircle class re-run. What happens if the centre of the circle is outside the display region of the window? Try it and see.

Replace Color.red by Color.blue or Color.green to change the colour of the circle. Experiment with other values to see what colours are available.

Notice again how helpful it has been to have meaningful names to represent values.

Now try displaying two circles in the window before looking at the next hint.


Previous Hint | Next Hint