Transparent JFrame/JWindow on Mac OSX with Java 7

倾然丶 夕夏残阳落幕 提交于 2019-12-22 10:53:21

问题


We have a screen sharing applet that opens up a Swing JFrame and uses the Robot class to capture the screen behind the empty frame.

The user is able to click through the frame and interact with whatever lies behind the applet. This works fine on Windows and used to work with Apple's Java version, but with Java 7 for Mac it does not work. Mouse clicks does not go through the JFrame.

The JFrame uses:

setAlwaysOnTop(true);
setUndecorated(true);

Tried using:

AWTUtilities.setWindowOpaque(false);

Or

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

With Apple's version the:

getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE);

Call did the trick, but this is no longer working.

Please advise.

Thanks, Eilon


回答1:


It's bug in jdk 7(will be fixed in jdk 9). There only way to use jdk 6.

link to bug database

P.s. have you find any solution of this problem?



来源:https://stackoverflow.com/questions/13020607/transparent-jframe-jwindow-on-mac-osx-with-java-7

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