Transparent JFrame/JWindow on Mac OSX with Java 7

2019-05-11 08:01发布

问题:

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?