能够点击java应用程序 [英] Ability to click through a java app
问题描述
我有一个简单的程序,atm显示一个带有图像的透明窗口,它始终位于其他窗口之上。是否可以通过我的应用程序直接输入,以便我可以点击下面的程序?
I've got a simple program which atm displays a transparant window with an image on it, which is always on top of other windows. Is it possible to direct input past my app so I can click on programs underneath?
例如,窗口在桌面背景上,我希望能够点击在图标而不是我的叠加应用程序。
For example, the window is over the desktop background and I want to be able to click on the icons instead of my "overlay app".
谢谢。
推荐答案
使用 JNA 的 WindowUtils
在Windows 7上实现此效果(其他系统未经测试):
Using JNA's WindowUtils
accomplishes this effect on Windows 7 (other systems untested):
JFrame frame = new JFrame();
//...
frame.setAlwaysOnTop(true);
System.setProperty("sun.java2d.noddraw", "true");
WindowUtils.setWindowTransparent(frame, true);
WindowUtils.setWindowAlpha(frame, 0.6f);
感谢Nate关于 setAlwaysOnTop
的评论这是一个更可行的选择。
Thanks to Nate's comment about setAlwaysOnTop
for making this a more viable option.
这篇关于能够点击java应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!