This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Write down what you mean by scatter. Do you want random locations? Do you want random speed and direction, vaguely towards the sweet?
When you have got that worked out, consider what sort of algorithm you want. Remember you can work out x and y coordinates for your fly and sweet, so you cna probably get away without using sin and cos. If you randomly move the fly a proportion of the x distance and a proportion of the y distance towards the sweet, you might get the desired effect.
For an animation (i.e. you want to change the image slightly at regular intervals) then you use a javax.swing.Timer. It regularly schedules a TimerTask, and each time that's run (via I think its actionPerformed method, but I haven't checked) you should draw the next iteration of the animation.