set Graphics Alpha - Java 2D Graphics

Java examples for 2D Graphics:Graphics

Description

set Graphics Alpha

Demo Code


//package com.java2s;
import java.awt.AlphaComposite;
import java.awt.Graphics2D;

public class Main {
    public static void setGraphicsAlpha(Graphics2D g, double alpha) {
        AlphaComposite ac = java.awt.AlphaComposite.getInstance(
                AlphaComposite.SRC_OVER, (float) alpha);
        g.setComposite(ac);/*ww  w .java  2s  .co m*/
    }
}

Related Tutorials