Java tutorial
//package com.java2s; import static java.awt.AlphaComposite.SrcIn; import java.awt.Graphics2D; public class Main { public static Graphics2D setGraphicsAlphaCovered(Graphics2D g2d, float alpha) { g2d.setComposite(SrcIn.derive(alpha)); return g2d; } }