Option 2: Implement the Dynamic Part as a Separate Component

1. Idea

Components know how to update themselves, so the Container that uses a Component need not explicitly draw them.

2. Example DrawCircles.java

See the Circle and BetterCircle examples, or the additional example in the Windows section. There, a Circle component (shown in Canvas and lightweight component sections) is added to the window centered at the location the user clicks.

© 1996-2000 Marty Hall, 1999-2000 Lawrence M. Brown