setWindowOpacity() 的 Swing 版本

Swing version of setWindowOpacity()

我尝试在 Java 中使用 TinyLaF 向 JFrame 添加不透明度。

我导入了这样的东西:

import static com.sun.awt.AWTUtilities.setWindowOpacity;

我使用 netbeans IDE。它向我显示了一个提示:

AWTUtilities is internal proprietary API and may be removed in a future release

所以想请教一下,有什么方法可以代替AWT setWindowOpacity()方法吗?

setWindowOpacity()方法的swing版本吗?

You can use,

Frame's setOpacity(floatValue) 方法根据您的要求。

注意: setOpacity() is not static so you can not use it like, Frame.setOpacity(..)