Q:

Java Graphics2D transparent background

I have a Graphics2D object and I want to set up the background of the object.  It has a setBackground method, which has a Color parameter.  This way I can set the color of the background. 
My question is: how can I set the transparency of the background of the object?  Can I somehow tell it to be completely transparent?  Can I somehow tell it to be completely opaque?  Can I somehow tell it to have 0.8 transparency/opacity?  How can I set these values? 
I have seen that there are int predefined values called TRANSLUCENT and OPAQUE, but I am not sure how can I use them. 
Maybe the correct usage is to call the constructor of Color with an int parameter? 

A:

You can construct a Color object by specifying a transparency.  For example the following code constructs a RED color with 50% transparency
Color c=new Color(1f,0f,0f,.5f );

A:

You can call the constructor of Color in the following way:
Color c = new Color(r,g,b,a);

where a is the alpha (transparency) value. 
As with all Java classes, you can find this information in the official API: http://docs.oracle.com/javase/7/docs/api/java/awt/Color.html
It's a really good resource and can spare you waiting for an answer on here.