code: public static void setAlpha(final Graphics pGraphics, final float pAlpha) {
          ((Graphics2D) pGraphics).setComposite(
                  AlphaComposite.getInstance(AlphaComposite.SRC_OVER, pAlpha)
          );
      }
docs: Sets the alpha in the {@code Graphics} object.
  <p/>
  Alpha is set by casting to {@code Graphics2D} and setting the composite
  to the rule {@code AlphaComposite.SRC_OVER} multiplied by the given
  alpha.
  
  @param pGraphics the graphics object
  @param pAlpha the alpha level, {@code alpha} must be a floating point
  number in the inclusive range [0.0,&nbsp;1.0].
  @throws ClassCastException if {@code pGraphics} is not an instance of
  {@code Graphics2D}.
  
  @see java.awt.AlphaComposite#SRC_OVER
  @see java.awt.AlphaComposite#getInstance(int, float)