Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.Graphics2D;

import java.awt.RenderingHints;

public class Main {
    /**
     * 
     * @param g
     * @param antiAlias
     * @param textAntiAlias
     */
    public static void setAntiAlias(Graphics2D g, boolean antiAlias, boolean textAntiAlias) {
        g.setRenderingHint(RenderingHints.KEY_RENDERING,
                (antiAlias) ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED);
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                (antiAlias) ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                (textAntiAlias) ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }
}