Anyone can to help me solve my java problem? I want 2 shapes to move at the same time when mouse dragged occurs. For example 2 objects name hat and face are created then when I mouseDragged face both face and hat will move together, but when I dragged hat only the hat will move and the face will stay on its current position. I'm done with most of the coding I'm just stuck on how to make them move together when dragged event occurs. My code is a bit long even from a rather simple program if anyone is interested in helping me shoot me a pm and I'll give you my code to take a look at it, if not give a sample code will work also. Thank you in advance to the people that will help me.

Within the face's drag event handler you can get the new mouse coordinates. If you kept a copy of the previous coordinates you know what the move was (change in x, change in y) and you can explicitly move the hat by that same amount.

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.