Java examples for 2D Graphics:Graphics
Sets the Graphics2D instance's anti-alias feature.
//package com.java2s; import java.awt.Graphics2D; import java.awt.RenderingHints; public class Main { /**//from w ww . java 2 s .co m * Sets the Graphics2D instance's anti-alias feature. * * @param g2d * @param use */ public static void setAntiAlias(Graphics2D g2d, boolean use) { if (use) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } else { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } } }