# Custom class that extends PGraphics class not working

**URL:** <https://discourse.processing.org/t/custom-class-that-extends-pgraphics-class-not-working/20199>\
**Category:** Coding Questions\
**Created:** [April 27, 2020, 10:31am UTC](https://discourse.processing.org/t/custom-class-that-extends-pgraphics-class-not-working/20199 "2020-04-27T10:31:41Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [April 30, 2020, 4:15pm UTC](https://discourse.processing.org/t/custom-class-that-extends-pgraphics-class-not-working/20199/3 "2020-04-30T16:15:50Z")

</div>

I think calling `super()` is not necessary in this case, see [Self contained layers by extending PGraphics](https://discourse.processing.org/t/self-contained-layers-by-extending-pgraphics/15307)

But I did need to call `setParent()`, `setPrimary()` and `setSize()`.

Ah looking at the code, I’m not sure the PGraphics can draw itself onto the main canvas. Can’t you call `image(theButton, 20.0, 20.0)` from whoever owns this Button?

---

_[View the full topic](https://discourse.processing.org/t/custom-class-that-extends-pgraphics-class-not-working/20199)._
