handles null parent in createGraphics