Java Window setWindowOpacity(Window window, float opacity)

Here you can find the source of setWindowOpacity(Window window, float opacity)

Description

set Window Opacity

License

Open Source License

Declaration

public static void setWindowOpacity(Window window, float opacity) 

Method Source Code

//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();
        }
    }
}

Related

  1. openWindow(final JPanel panel)
  2. putWindowNormalBounds(Window window, Rectangle bounds)
  3. removeWindow(Window w)
  4. repaintMnemonicsInWindow(Window w)
  5. setWindowAlpha(Window w, int value)
  6. show(final Container container, final boolean visible, Window appearOnLeftSide)
  7. show(JWindow window)
  8. showLater(final Window win)
  9. showMessageWindow(String message, JWindow parent)