Here you can find the source of transparentColor(Color color, int alpha)
Parameter | Description |
---|---|
alpha | 0: completely transparent; 255: completely opaque. |
public static final Color transparentColor(Color color, int alpha)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { /**//w w w . ja v a 2 s. c o m * @param alpha 0: completely transparent; 255: completely opaque. */ public static final Color transparentColor(Color color, int alpha) { if (color == null) return null; /* int rgba = color.getRGB(); rgba |= 0x000000ff; alpha |= 0xffffff00; rgba &= alpha; return new Color (rgba, true); */ return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); } }