public static void cleanUp() throws IncorrectUsageException {
        Throwable t = new Throwable();
        StackTraceElement[] elements = t.getStackTrace();
        String className = elements[1].getClassName();
        String methodName = elements[1].getMethodName();
        //@formatter:off
        if (!className.equals("com.blp.gfxlib.Game") || !methodName.equals("draw"))
            throw new IncorrectUsageException("method cleanUp called in " + className + " is used incorrectly");
        //@formatter:on
        g.dispose();
    }