Here you can find the source of changeAlpha(Color c, double newAlpha)
public static Color changeAlpha(Color c, double newAlpha)
//package com.java2s; import java.awt.Color; public class Main { public static Color changeAlpha(Color c, double newAlpha) { if (newAlpha < 0) newAlpha = 0;/*from w w w. j a v a2 s . c o m*/ if (newAlpha > 1) newAlpha = 1; return new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) Math.round(newAlpha * 255)); } }