No. Don't touch the paint event. You only need setMask() just like jpn suggested. And better put it in resize event and not in the constructor, just in case. But it should still work with the constructor (the same contents as in the resize event).