0

What I would like in Java is to create a transparent screen over the entire screen that does not respond to events such as mouse or keyboard. Essentially, the user won't even know about the screen. How would I make the window "transparent" to events?

hyper-neutrino
  • 5,272
  • 2
  • 29
  • 50

1 Answers1

0

Read the section from the Swing tutorial on Creating a Translucent Window.

You would use an opacity of 0.0f.

Edit:

With an opacity of 0.0f the events go through the frame to the component below, therefore the window you click on will come to the front.

With a non-zero opacity (ie 0.05f) the events are intercepted by the frame.

You may also need to use:

frame.setAlwaysOnTop( true );

to prevent the window from coming to the front.

Play with the opacity and always on top property to get your desired effect. If these two properties don't work then I have no ideas to do what you are asking, nor do I understand the requirement.

camickr
  • 321,443
  • 19
  • 166
  • 288
  • Yes, but when I click, the event causes the window behind to come front, and I want the transparent frame to stay in front. – hyper-neutrino Jul 19 '15 at 01:28
  • @JamesSmith, in your original question you stated: `It also allows events to go through it.` - which is why I suggested an opacity of 0.0f. See edit. – camickr Jul 19 '15 at 02:54