Mouse Presses Outside Sketch Window

edited January 2015 in How To...

I have been able to get the location of the mouse outside a Processing sketch using the solution here:,
but I would also like to be able to receive other mouse events like clicking, outside the processing sketch. Is this possible?



  • Ah, I wanted to tell if the mouse was clicked, not to click it myself (that's how it seems you interpreted the question to me). Like mousePressed(), just being able to go outside the sketch. I can't seem to find a java class to to this, but then again, I'm not really very familiar with java outside of Processing.

  • edited January 2015

    Could this be used? How could it be distinguished from the Processing version?

  • That's a AWT library. Same used by Processing already! ^#(^ 1st explanation written there is:

    An event which indicates that a mouse action occurred in a component. A mouse action is considered to occur in a particular component if and only if the mouse cursor is over the unobscured part of the component's bounds when the action happens.

    So it's bound to a component. It won't work outside of 1! 8-|

  • You can't do this with Java, so you can't do it in Processing, either.

    If this is really a requirement, you're going to have to write some native code, which can get pretty gross.

    There are other hackish workarounds (take a screenshot of the image and display it in a big window), but the bottom line is that this isn't possible.

    Why do you want to do this anyway?

  • edited January 2015

    Oh, that's a shame. It was just for an animated desktop background/wallpaper I had made using Processing > Syphon > Quartz Composer and then displayed on the background using some application that lets you use screen savers (which can be Quartz compositions) as desktop backgrounds (which can't), called xBack, which I found in some random corner of the internet. Anyway, it all works quite well and I have been able to play Pong on my desktop, as I'm able to track the mouse anywhere on the screen.

    All I wanted the click functionality for was just to give it a little a little more animation/functonality - maybe if you click on something a colour changes, or maybe you have an image/sprite tracking where the mouse is on the background which changes underneath the mouse when you click. Hope I didn't lose you there, but you should get the gist of it.

  • Perhaps search for JNative in the site: it has been mentioned sometime for this kind of requirement.

Sign In or Register to comment.