• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Screen Cap on Mouse Click Anywhere

 
Jerry Jasuta
Greenhorn
Posts: 2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20971
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch

I think this question is too difficult for "beginning" and shall move it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic