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.
Hi: I'm currently taking my first Java Programming class. My current project involves the creation of 9 reindeer within an applet. Those reindeer have been created. Now I need to be able to move them collectively with a mouseEvent so that they follow the mouse. I can get them to be selected simultaneouslly, but they don't keep their spacing--when I select them with a mouse click, they end up piling up on top of each other.
Hi, Welcome to JavaRanch! Presumably you're getting some x,y coordinates from the mouse event, and drawing the reindeer at those coordinates. What you'll need to do, simply stated, is use different x,y coordinates for each reindeer. You might simply use x+0, x+5, x+10 ... for the 1st, 2nd, 3rd reindeer, or you could do something more complex in which both the x and y coordinates varied for each reindeer, perhaps not even in such a linear way. But anyway, the solution to your problem is quite simple: don't draw them all in the same place!