是否有可能使JFrame具有透明背景並在其上繪製圖像,因此只有圖像在沒有邊框或背景的情況下可見?透明JFrame背景
6
A
回答
9
參見Kirill Grouchnikov的Translucent and Shaped Swing Windows。
0
對於Mac OS X示例,請參閱Re-paint problem on translucent frame/panel/component。
0
這是可能的。
如果你的JFrame是一個局部變量或字段:
myJFrame.setUndecorated(true);
如果你的類擴展JFrame中:
setUndecorated(true);
+1
是真的,因爲jdk7,透明度只支持未修飾的框架。如何調用方法應該是基本知識,儘管:-) – kleopatra 2012-10-21 09:19:21
9
是的,它可能在很多方面。這是其中之一:
setUndecorated(true);
setBackground(new Color(1.0f,1.0f,1.0f,0.5f));
Color的構造函數中的第4個浮點數(我設置爲0.5f)是alpha通道。它可以是0.0f - 1.0f取決於你想要的透明度。
1
您應該使內容窗格透明。
frame.setUndecorated(true);
frame.getContentPane().setBackground(new Color(1.0f,1.0f,1.0f,0.0f));
frame.setBackground(new Color(1.0f,1.0f,1.0f,0.0f));
相關問題
- 1. 透明背景JFrame Linux上的動畫
- 2. 帶有模糊透明背景的JFrame
- 3. 透明背景
- 4. html透明背景
- 5. 與透明背景
- 6. Iframe透明背景
- 7. webview透明背景
- 8. NSTableCellView透明背景
- 9. UIToolBar背景透明
- 10. Pygame透明背景
- 11. AS3透明背景
- 12. JOGL透明背景
- 13. PHP:透明背景
- 14. Div背景透明
- 15. AChartEngine透明背景
- 16. UWP:MapControl透明背景
- 17. 與透明背景
- 18. Recyclerview透明背景
- 19. 透明.png背景
- 20. Imageview背景透明
- 21. 背景不透明
- 22. UIView背景透明
- 23. WPF透明背景
- 24. Fotorama透明背景
- 25. TTStyledTextLabel透明背景
- 26. AQGridViewCell透明背景
- 27. AchartEngine背景透明
- 28. phpqrcode透明背景
- 29. 與透明背景
- 30. css背景透明
鏈接現已停止。谷歌建議這個博客文章:http://www.pushing-pixels.org/2008/02/27/translucent-and-shaped-windows-in-core-java.html – 2018-03-04 20:59:50