问题
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