开发者

Translucent background on JWindow in Java (without using screenshots)

开发者 https://www.devze.com 2023-02-06 02:18 出处:网络
I\'ve seen other answers and hacks around to this question, but none seem to do exactly what I\'m after.

I've seen other answers and hacks around to this question, but none seem to do exactly what I'm after.

Essentially, I'm after a JWindow whose background is translucent but the content of the window itself (buttons, text and so on) are opaque. The methods I've seen so far fall into one of two categories:

  • Taking screenshots from behind the window and using them (http://onjava.com/pub/a/onjava/excerpt/swinghks_hack41/index.html) - this isn't much good in this scenario since it's too slow, I want to be able to put things like video behind the window and have it show through
  • Making the whole window translucent (including the components on it which I need to remain opaque.)

Is what I'm asking for possible, and if so how would it be done? If not, will Java 7 provide any methods that would 开发者_Go百科make this easier / possible? I know it's got more support built in for shaped windows so I wonder whether something there could take care of this also. I've been searching around for a while now but with no luck.


Can only be done if you are using JDK 6 update 10 and above. Must also support hardware acceleration. See

http://download.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html

0

精彩评论

暂无评论...
验证码 换一张
取 消