I am working with events in Java Swing and it happens that in a JFrame I have uploads of three images. What I need is to know how I can make it so that when I press an image when the program runs, it moves vertically and I myself can stop it with another click or by clicking on the second image. If I click on the second image, the first one should stop and the other one should start moving. How can I get this result in Netbeans?
If you wrap the images in a
JLabel
, you can add ain the part where you process the event you can add an animator that moves the components where you want them.