Graphics2D (Graphics g, PainterHelper helper, JComponent component) { MyGraphics gg = g instanceof MyGraphics ? (MyGraphics)g : null; return new MyGraphics(gg != null ? gg.myDelegate : g, helper, helper.computeOffsets(g, component), gg != null ? gg.preserved : null); }