Java tutorial
//package com.java2s; import java.awt.Graphics2D; import java.awt.RenderingHints; public class Main { /** * Restores anti-aliasing in the supplied graphics context to its original setting. * * @param rock the results of a previous call to {@link #activateAntiAliasing} or null, in * which case this method will NOOP. This alleviates every caller having to conditionally avoid * calling restore if they chose not to activate earlier. */ public static void restoreAntiAliasing(Graphics2D gfx, Object rock) { if (rock != null) { gfx.setRenderingHints((RenderingHints) rock); } } }