Help: Colored panes


Help is available for each task, or you can go straight to the solution source code.

Task 1

Create class ColorCanvas as a subclass of Canvas. Make a constructor that sets an instance variable according to the color passed in.
Your instance variable should be of type Color.

Task 2

Define a paint method that sets the color and fills the entire region with that color.
Define paint just like you would for an applet. Use method fillRect. To obtain the size of a component, use method size.

Copyright © 1996-1997 MageLang Institute. All Rights Reserved.