I use this part to make transparent the JFrame:
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
boolean opacity_supported = gd.isWindowTranslucencySupported(java.awt.GraphicsDevice.WindowTranslucency.TRANSLUCENT);
if( !opacity_supported )
{
System.out.println("Your platform does not support opacity.");
}
else
{
setOpacity((float) 0.85);
}
It works perfect on Windows. On the same machine I use also Ubuntu 11.10. I open the same project on Eclipse of Ubuntu, but it gives error on these methods:
java.awt.GraphicsDevice.WindowTranslucency.TRANSLUCENT
The error is:
The type java.awt.GraphicsDevice.WindowTranslucency is not visible
setOpacity((float) 0.85);
The error is:
The method setOpacity(float) from the type Window is not visible
I can not even built the project to test it. Java is cross platform. It must built the project and if the platform does not support the opacity it must give a warring from console. But the problem is i can eve built the project because it warns me about these both methods.
I try it on Java 1.6 and 1.5 both from Eclipse.
Thanks in advance...