Check out example codes for "java animated gif example". It will help you in understanding the concepts better.

Code Example 1

Image icon = new ImageIcon(new URL("http://i.stack.imgur.com/KSnus.gif")).getImage();
...
g.drawImage(icon, 20, 20, this);

Learn ReactJs, React Native from akashmittal.com