Here you can find the source of setWindowOpacity(Window window, float opacity)
public static void setWindowOpacity(Window window, float opacity)
//package com.java2s; import java.awt.Component; import java.awt.Window; import java.lang.reflect.Method; import javax.swing.SwingUtilities; public class Main { public static void setWindowOpacity(Component c, float opacity) { setWindowOpacity(SwingUtilities.getWindowAncestor(c), opacity); }// w ww. j a va 2 s. com public static void setWindowOpacity(Window window, float opacity) { try { Class clazz = Class.forName("com.sun.awt.AWTUtilities"); Method opacityMethod = clazz.getDeclaredMethod( "setWindowOpacity", Window.class, float.class); opacityMethod.invoke(null, window, opacity); } catch (Exception exc) { exc.printStackTrace(); } } }