Graphics2D.setRenderingHints(Map <?,?> hints) has the following syntax.
public abstract void setRenderingHints(Map <?,?> hints)
In the following code shows how to use Graphics2D.setRenderingHints(Map <?,?> hints) method.
//from www.java2 s . c o m import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import javax.swing.JFrame; import javax.swing.JPanel; public class Main extends JPanel { public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Font f = new Font ("Arial", Font.PLAIN, 48); g2.setFont (f); g2.drawString ("www.java2s.com", 10, 60); RenderingHints rh = g2.getRenderingHints (); rh.put (RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints (rh); g2.drawString ("Antialiased text", 10, 120); } public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new Main()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); } }