public static Object activateAntiAliasing ( Graphics2D gfx ) { RenderingHints ohints = gfx . getRenderingHints ( ) , nhints = new RenderingHints ( null ) ; nhints . add ( ohints ) ; nhints . put ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; nhints . put ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; gfx . setRenderingHints ( nhints ) ; return ohints ; }
Activates anti - aliasing in the supplied graphics context on both text and 2D drawing primitives .