4

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".

Thanks.

Mourtong
  • 41
  • 2

3 Answers3

1

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);

Thanks to Nate's comment about setAlwaysOnTop for making this a more viable option.

Mark Peters
  • 80,126
  • 17
  • 159
  • 190
0

You can click through a JFrame with this code...

AWTUtilities.setWindowOpaque(this, false);
AWTUtilities.setWindowOpacity(this, 0.8f);
wattostudios
  • 8,666
  • 13
  • 43
  • 57
lidox
  • 1,901
  • 3
  • 21
  • 40
0

I don't think you can do it easily, this because after that your OS has dispatched the mouse click to the Java application you can't dispatch that again back to activate whatever is beneath the Java application.

You could do it easily if everything is inside just one Java application but not with separate environments.

Jack
  • 131,802
  • 30
  • 241
  • 343