super.addDirtyRegion(comp,x,y,w,h); JComponent root = getRootJComponent(comp); // to avoid a recursive infinite loop if(comp != root) { super.addDirtyRegion(root,0,0,root.getWidth(),root.getHeight()); }
Container parent = comp.getParent(); if(parent instanceof JComponent) { return getRootJComponent((JComponent)parent); } return comp;