Making JWindow invisible and capture mouse events.

How can I make a JFrame or JWindow completely invisible or transparent and at the same time allow it to capture mouse events?Thanks,Darrin
[166 byte] By [dmorris3] at [2007-9-26 4:11:53]
# 1
Can't do it.ALL YOUR DUCK DOLLS ARE BELONG TO ME?
kaze0 at 2007-6-29 13:17:17 > top of Java-index,Archived Forums,Swing...
# 2
more importantly than the fact that you cant do it is why on earth you are trying to do it?
cpc9 at 2007-6-29 13:17:17 > top of Java-index,Archived Forums,Swing...
# 3
I am trying to make a screen capture utility. I want to be able to click and drag to rubberband the on the screen that I want to capture.Is there any way to capture mouse events on the screen and not in a window?Thanks,Darrin
dmorris3 at 2007-6-29 13:17:17 > top of Java-index,Archived Forums,Swing...
# 4
mouse events only occur when the mouse is over the window. if it's invisible, you'll never get any events.
almilli at 2007-6-29 13:17:17 > top of Java-index,Archived Forums,Swing...
# 5
the only way to do that is to use JNI and C++ to draw on the screen.
almilli at 2007-6-29 13:17:17 > top of Java-index,Archived Forums,Swing...
# 6
i think u can use JWindow().getGlassPane() method .. this is for exactly the same purpose u require . hope this helps
raj_rash36 at 2007-6-29 13:17:17 > top of Java-index,Archived Forums,Swing...
# 7

Hi,

Normaly if you do setVisible(false) you will never get any mouse event. I think (but i'm not sure) that if you do setVisible(true); and setOpaque(false); you can get mouse event and your window will not been seen.

If it's not, you can use the Robot class (in awt). You know exactly where your window will appear, you do Robot.createScreenCapture() and specify the location and size of your window. When you make your window visible you draw in it the image you get with createScreenCapture().

Jo

Note : i think you should use the awt.window class whereas JFrame

jofabrizio at 2007-6-29 13:17:17 > top of Java-index,Archived Forums,Swing...