This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes a bit of advice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "a bit of advice" Watch "a bit of advice" New topic

a bit of advice

joew weakers
Ranch Hand

Joined: Aug 21, 2003
Posts: 48
Hey there. Not too sure if I should be posting this query here but it is so general that I wasn't sure where to post it. Basically what I want to do is to record every user interaction that a particular user has with a map representation in some sort of log file. My program renders maps to the screen and the user can switch features on and off and zoom in and out of various regions in the map. The program is set up to catch mouse events so that if the user clicks on, selects or drags on any part of the map, using the mouse, this can then be recorded. So simply is there any particular approach to recording these mouse events in logs or some other format that would best suit the requirements of my system. I am merely looking for advice on what is the best method to record user interaction wit hmy map system. Thanks a lot ... Joe
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
Hi, Joew -
I'm assuming that you're running this on a server.
Off the top of my head, I think the simplest solution would go something like the following:
Upon startup, your server can open a log file for the day's events, then pass that File object to a FileWriter. Your mouse event handler can write the name of the object triggering the event, and the mouse x-y coordinates, or any other info you may want to capture, to a simple text file using the FileWriter.
FileWriter has a write method that appends to an existing file:

Hope that helps.

Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
joew weakers
Ranch Hand

Joined: Aug 21, 2003
Posts: 48
Thanks Jeff. I will give that a shot
I agree. Here's the link:
subject: a bit of advice
Similar Threads
a bit of advice
Caching Records for "Bodgitt and Scarper"
More Model-View-Controller advice needed
re: Java Logger Class
re: help appreciated