// See 
public void paint(Graphics g) {
// Retrieve the graphics context; this object is used to paint shapes
Graphics2D g2d = (Graphics2D)g; // Determine if antialiasing is enabled
RenderingHints rhints = g2d.getRenderingHints();
boolean antialiasOn = rhints.containsValue(RenderingHints.VALUE_ANTIALIAS_ON); // Enable antialiasing for shapes
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON); // Disable antialiasing for shapes
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF); // Draw shapes...; see // Enable antialiasing for text
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // Draw text...; see // Disable antialiasing for text
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
}
Related Examples
05-11 17:43