Where's the paint() Method?

You may have noticed something funny about the previous applet. There's no paint() method! And yet the text gets drawn on the screen anyhow. How does this happen?

Components know how to paint themselves. When a container like an applet is repainted it not only calls its own paint() method, it calls the paint() method for all the components it contains.

java.awt.Label has its own paint() method which knows how to paint() itself. The short of it is that you don't need to worry about painting components unless you create your own component classes or modify the appearance of the system supplied components.


Previous | Next | Top
Last Modified November 4, 1997
Copyright 1997 Elliotte Rusty Harold
elharo@metalab.unc.edu