I have to get an animation to restart once the user scrolls the mouse over the image... I know I have to use MouseMotionListener, what I don't know is how to get the coordinates of the image to do this operation. I'm using GridBagLayout manager, the whole thing runs inside a JInternalFrame, generated by an applet. any suggestions are welcomed, thanx --matt

With MouseMotionListener, you got the method MouseMoved(MouseEvent e)
To get the coordinate, just do e.getX() and e.getY(), is that what you need?

Perhaps if you use null Layout.. setLayout(null);
Then for each component, say JPanel panel, you would do:
panel.setLocation(50,50) or whatever, don't forget to panel.setSize(100,100), or it wont show.

Not sure if that will help, gridbag is a pain, I usually use Null now, and just make sure my Frames are fixed size.

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.