How to click through JGlassPane With MouseListener to UI behind it

Posted by Epicmaster on Stack Overflow See other posts from Stack Overflow or by Epicmaster
Published on 2012-11-06T22:01:11Z Indexed on 2012/11/06 23:00 UTC
Read the original article Hit count: 263

Filed under:
|
|

I have a JFrame and a bunch of JComponents on top of the JFrame. I need to make use of the JGlassPane and I used this implementation to set it up.

   JPanel glass = new JPanel();
   frame.setGlassPane(glass);
   glass.setVisible(true);
   glass.setOpaque(false);

After doing so I can't select any JButtons or other JComponents under the JGlassPane.

Is there a way to have only the components on the GlassPane selectable while still having the ability to select components under the GlassPane?

Edit I forgot to mention (not knowing this would be relevant) that I did attach both a MouseListener and a MouseMotionListener to the glass pane. Is there a way to pass the Mouse Events to other components and only use them when needed?

© Stack Overflow or respective owner

Related posts about java

Related posts about swing