/** * Return whether the given icon is animated. Currently assumes the original filename ends with * "animated.gif". */ public static boolean isAnimated(Icon icon) { // Kind of a hack... can we see if it's an animated GIF by looking // inside the ImageIcon some other way? if (icon instanceof ImageIcon) { // NOTE: icon.toString() may return null! String label = icon.toString(); if (label != null && label.indexOf("animated.gif") != -1) return true; } return false; }