Here you can find the source of setRenderingHints(Graphics2D g2d)
public static void setRenderingHints(Graphics2D g2d)
//package com.java2s; //License from project: Apache License import java.awt.Graphics2D; import java.awt.RenderingHints; public class Main { public static void setRenderingHints(Graphics2D g2d) { // This time, we want to use anti-aliasing if possible to avoid the // jagged edges // With the Java 2D rendering engine (Graphics2D) to do this using a // "rendering hint". RenderingHints rh = g2d.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); // rh.put(RenderingHints.KEY_COLOR_RENDERING, // RenderingHints.VALUE_COLOR_RENDER_QUALITY); // rh.put(RenderingHints.KEY_ALPHA_INTERPOLATION, // RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); // rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, // RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // rh.put(RenderingHints.KEY_FRACTIONALMETRICS, // RenderingHints.VALUE_FRACTIONALMETRICS_ON); g2d.setRenderingHints(rh);// w ww. j a va2 s . co m } }