我剛剛遇到的實用程序(com.sun.awt.AWTUtilities
)使您的JFrame 真的透明。文檔here。這工作非常好。即使在桌面效果打開窗口的Linux環境下(Here a little video)!但是我想在透明的JFrame上製作一個非透明的組件。Java:具有非透明組件的透明Windows?
有誰知道,如果這是可能的,怎麼樣?
這裏是我使用的代碼:
import com.sun.awt.AWTUtilities;
/* "this" is the JFrame */
this.setUndecorated(true);
AWTUtilities.setWindowOpaque(this, true);
AWTUtilities.setWindowOpacity(this, 0.5f);
AWTUtilities.setWindowShape(this, new RoundRectangle2D.Float(0f, 0f, (float) getWidth(), (float) getHeight(), 15f, 15f));
感謝
這不適用於Linux ...在Mac上,這是我的問題的解決方案...悲傷... – 2010-07-31 11:48:53
@Martijn Courteaux:那麼,'AWTUtilities'演示:「請注意,效果可能不支持底層平臺......「 – trashgod 2010-07-31 12:25:56