File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Screen Cap on Mouse Click Anywhere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Screen Cap on Mouse Click Anywhere" Watch "Screen Cap on Mouse Click Anywhere" New topic
Author

Screen Cap on Mouse Click Anywhere

Jerry Jasuta
Greenhorn

Joined: Jan 25, 2011
Posts: 2

I'm new to Java, and I have a small project for work, but it's turning out to be a bit more involved than I thought.

Environment: uneducated users on buggy POS software using touchscreens in a fast paced restaurant
Problem: when an error occurs, they often click "OK", or alt+f4, etc. without getting help or noting the error message
Solution: screencap onmousepress, and save past 50 screencaps for troubleshooting
(I know the true solution is get better POS software and educate the users, but I want a fail-safe trouble shooting method)

This is my first Java project, so please bear with me. I'm currently polling the MouseInfo every 200ms to determine if the mouse pointer has moved, since movement only occurs on a touchscreen when the screen is "clicked", and then using the Robot to take and save a screen cap. I would prefer to use a listener that somehow responds to the system's mouse events, so I can hook into mouseclicks anywhere. I realize I will probably have to use a mousehook outside java, but I have no idea how to implement one.

Here's what I'm starting with:


I would prefer events to polling. Suggestions, including opinions on the best way to package such a project, are very much appreciated!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Jerry Jasuta wrote:I would prefer to use a listener that somehow responds to the system's mouse events, so I can hook into mouseclicks anywhere. I realize I will probably have to use a mousehook outside java, but I have no idea how to implement one.


Yes, that is what you would have to do. But you can't use Java to do that. You would have to write code in some other language which runs on your POS system, then use JNI or JNA to call that code from Java. I wouldn't say this is a good project for somebody who is new to Java.
Jerry Jasuta
Greenhorn

Joined: Jan 25, 2011
Posts: 2

Paul Clapham wrote:Yes, that is what you would have to do. But you can't use Java to do that. You would have to write code in some other language which runs on your POS system, then use JNI or JNA to call that code from Java. I wouldn't say this is a good project for somebody who is new to Java.


Thanks for your reply. I have already written a C++ prog that will grab the mousehook, so now I just have to read up on how to use listeners between Java and my prog with JNI or JNA.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37953
    
  22
Welcome to JavaRanch

I think this question is too difficult for "beginning" and shall move it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Screen Cap on Mouse Click Anywhere
 
Similar Threads
Capturing ScreenShot of the the Active Window
Robot().createScreenCapture() to capture 2nd monitor?
Obtaining position of cursor on JPanel
How can i have the coordinate on a buffered image ?
How to make popup invisible