public static ImageIcon getIcon ( String fullIconName , boolean errMsg ) { ImageIcon icon = null ; java . net . URL iconR = cl . getResource ( fullIconName ) ; if ( debugIcon ) { System . out . println ( "classLoader " + cl . getClassLoader ( ) ) ; System . out . println ( " Resource.getIcon on " + fullIconName + " = " + iconR ) ; } if ( iconR != null ) icon = new ImageIcon ( iconR ) ; if ( ( icon == null ) && errMsg ) System . out . println ( " ERROR: Resource.getIcon failed on " + fullIconName ) ; else if ( debugIcon ) System . out . println ( " Resource.getIcon ok on " + fullIconName ) ; return icon ; }
Get a gif file make it into an ImageIcon .