Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats all this about subclassing Canvas and overriding paint() ? Can I just do a getGraphics() for a component, and draw directly on that?

0
10 Posted

Whats all this about subclassing Canvas and overriding paint() ? Can I just do a getGraphics() for a component, and draw directly on that?

0
10

• A. You can do that, and it might work up to a point (or it might not). A problem arises when the window system wants to refresh that component e.g. because it has been partially obscured and is now revealed. It calls paint(), and paint() has no knowledge of the other g.drawing() you have just done.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123