• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Screen Cap on Mouse Click Anywhere

 
Greenhorn
Posts: 2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Marshal
Posts: 27451
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 76845
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch

I think this question is too difficult for "beginning" and shall move it.
 
No more fooling around. Read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic