Results 1 to 2 of 2
  1. #1
    CuppaCoffee's Avatar
    CuppaCoffee is offline Member
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    80
    Rep Power
    0

    Default How to Measure Speed in Java?

    Greetings, everyone. Before I explain the title, I just want to introduce what I'm trying to do:

    I have a series of images. Mostly a body with two arms. It responds to the movement of the mouse. When the mouse moves, I want the arms to rotate backwards, as if dealing with a lot of air resistance. I have no problems with the rotation, the only issue is I want the arms to flail back more and more the faster the mouse is moving.. But then, how do I measure the speed of the mouse? Is there a way to measure how much pixels the mouse is covering when it moves over a certain amount of time? Or is there another method to get different results of an action to occur when dealing with various speeds of MouseMotion movement?

    I hope this isn't too vague. If you need any clarifications in order to help me out with this issue, feel free to let me know

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,590
    Rep Power
    23

    Default Re: How to Measure Speed in Java?

    The mouse's position and the time the mouse was at that position should allow you to compute a speed:
    change in position/change in time.
    The System class has a method that returns the current system time.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Java Applet speed?
    By Masherbrum in forum New To Java
    Replies: 0
    Last Post: 04-06-2012, 03:11 AM
  2. Measure limited time for a process
    By Vinn in forum New To Java
    Replies: 3
    Last Post: 03-06-2012, 08:27 PM
  3. .NET developer looking to get up to speed with Java
    By Les Paul in forum New To Java
    Replies: 1
    Last Post: 10-15-2011, 07:17 PM
  4. Replies: 0
    Last Post: 01-04-2010, 10:40 AM
  5. How can I measure the data rate of my connection
    By islamfunny in forum CLDC and MIDP
    Replies: 0
    Last Post: 09-25-2008, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •