[英]How to make the JFrame contentPane transparent but the JFrame visible?
[英]how to make components visible in a transparent JFrame
我在JFrame中有一些JButton(其布局為null)。 按鈕的背景色設置為黑色。 我已經通過使用此代碼使JFrame透明。
AWTUtilities.setWindowOpacity(this, 0);
但是問題在於它也使所有按鈕也透明。 我不要 我想看到按鈕保持黑色,但JFrame的其他部分變成透明的(以便可以看到桌面背景)。 請有人幫我。 提前致謝。
使用通話button.setOpaque(true)
怎么樣?
是的,問題是不透明度設置為零。 所有button.setOpaque(true)的任何非零值都將清楚顯示按鈕。 對我來說,AWTUtilities.setWindowOpacity(frame,0.7f)也可以工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.