Re: HelloWorld's response, there are two caveats.

First and more important, the method to override for performing custom painting in a JComponent subclass is paintCOmponent(...), not paint(...).
...