This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
We don't simply give out such answers, but if you would show us what you have so far, we shall be happy to comment on it.
By the way: it sounds very unusual behaviour for a button to start motion, then stop it when the mouse is released.
What you have in mind is not possible with the action listener.
An action performed will not be fired until a successful click.
Check out the mouse listeners.
Like Campbell said, try out various scenarios on your own. If you run into a problem, show us your code, and we will be more than happy to help you figure out what is going wrong.
Best of luck.
Please read my previous reply carefully why it is not possible with an action listener.
In case you do not know about mouse listeners, here is a tutorial
Joined: Oct 13, 2005
Maneesh has already told you, you need a different Listener. You would also need a Timer (at the very least) or a new Thread to move the object. Have a look through the tutorial you have been told about.