This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

How to serialize events to playback later on in Swing

 
Ranch Hand
Posts: 96
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I would like to save all mouse and keyboard events as well as udp messages received to a file in order to be loaded and played back later on an so analyze the user performance.

I have seen class Robot but it seems quite old.

Perhaps there are newer frameworks doing this easily.

I don't know very well how to begin.

Could someone recommend me any technology, framework,... compatible with Swing?

Thaks in advance.
 
Saloon Keeper
Posts: 11462
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is pretty good about documenting obsolete classes and alternatives to use. Robot is old, but they haven't deprecated it yet. It might just do what you want. Why don't you just try it out?
 
Alfonso Sanz
Ranch Hand
Posts: 96
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stephan,

thanks for your quick answer.


Great, I'll use Robot then for playback, but for recording... I  have seen that it appears I should serialize KeyEvent and MouseEvent, should I?

Thanks in advance.
 
Stephan van Hulst
Saloon Keeper
Posts: 11462
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that was my conclusion as well, although you may want to serialize events like ActionEvent, FocusEvent and PropertyChangeEvent as well to verify that the robot is replaying correctly.

Don't use ObjectOutputStream to serialize the events. Use XMLEncoder instead.
 
Alfonso Sanz
Ranch Hand
Posts: 96
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again for your quick answer and your piece of advice.
 
What are your superhero powers? Go ahead and try them on this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!