This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I would really appreciate your help with a program that has been bugging me for over a week now.
Essentially I am using threads to control balls within a Jframe (10 balls). When i click within the frame the balls start their motion again from this point. There is also a 10 pixel wide invisible line down the center of the frame that the ball rebound off when they hit it.
What i would like to achieve is for the balls to rebound of the wall if they are designated as even as stick to the wall if they are odd. I have worked out that I will need to use a modulo such as i%2==1 to work out whether it is odd for example.
I would appreciate your time and suggestions.
(there is a 'ball' class that I have not included so as to keep the problem area as concise as possible)