public static void setOpaque(Window window, boolean opaque) {

        String version = System.getProperty("java.runtime.version");
        if (version.startsWith("1.7")) {
            window.setBackground(new Color(0, 0, 0, 0));
        } else {
            try {
                Class<?> awtUtilsClass = Class.forName("com.sun.awt.AWTUtilities");
                if (awtUtilsClass != null) {

                    Method method = awtUtilsClass.getMethod("setWindowOpaque", Window.class, boolean.class);
                    method.invoke(null, window, opaque);

                }
            } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exp) {
            }
        }
    }