1 | Suppose that we want to use the drawing methods on a subarea of the applet. To do that, we introduce a Canvas, instead of a Panel. |
2 | Like an applet, you can have a paint (Graphics g) method for a canvas, in which you can call methods such as g.setColor( ) and g.drawRect ( ... ), and also the repaint( ) and update(Graphics g) methods are built in as well for canvases. |
3 | Since we want to define our own paint method for the canvas, we should define a separate class that extends a Canvas. |