Transparent Swing Windows

空扰寡人 提交于 2019-12-23 10:09:52

问题


I have a little JWindow with a logo on it that users can drag stuff to. I develop my application mainly on OS X. To get a transparent window i use

setBackground(new Color(0,0,0,0));

On a mac this works beautifully but I can't get the same effect on windows. Is there any way to get a transparent window without using 1.6 specific features.

I need 1.5 compatibility.


回答1:


As of 1.5 Java does not support transparent windows. This feature is introduced as part of 1.6.10 release. See AWTUtilities class for more details.




回答2:


Sadly, windows (previous to Vista at least) doesn't do this kind of compositing. There is however a workaround. Example code can be found at http://rabbit-hole.blogspot.com/2007/02/non-rectangular-windows-update.html



来源:https://stackoverflow.com/questions/1195186/transparent-swing-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!