Hey guys I found the following code snippet below... I want to know how to compile this... I am a c++ programmer and something is wrong with my mouse/audio so I thought this may programmatically solve it but I have no clue about anything java and in c++ there is no onmousemove or on mouse stop functions... I tried negating the movemouse event in c++ but its a no go and thats when I found the snippet below...

Can someone compile it because Im on a mac and I tried really hard to turn it into an executable for macs by typing:

cd ~/desktop
javac document.java

Note I did try putting these at the top as header files:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

It failed to compile with errors and I really cannot handle learning 3 languages... Objective-C, C++ and C# all at once... Or I would try learning java to get it to work.
This is not for any school projects or anything as Im taking mechanical engineering but I do programming in my spare time and right now Im trying to figure out the link between the audio on a computer and the trackpad... but im kinda stumped doing this in c++ but that java code below is exactly what I want it to do...


When the mouse is not moving, the program makes it go around in circles 5-7 pixel diameter... but when the user touches the trackpad / moves the mouse, the code stops running..and repeats. not sure how to specify the diameter either :S

document.onmousemove = (function() {
  var onmousestop = function() {
    /* movemouse in circles of 5px diameter */
  }, thread;

  return function() {
    clearTimeout(thread);
    thread = setTimeout(onmousestop, 500);
  };
})();

That is not Java code you posted, it is JavaScript. Try posting your question in the JavaScript forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.