public static Image getImageFromResources ( Class < ? > clazz , String name , Toolkit toolkit ) throws IOException { byte [ ] imageData ; InputStream in = clazz . getResourceAsStream ( name ) ; if ( in == null ) throw new IOException ( "Unable to find resource: " + name ) ; try { imageData = IoUtils . readFully ( in ) ; } finally { in . close ( ) ; } return toolkit . createImage ( imageData ) ; }
Loads an image from a resource using the provided toolkit .