public Image loadImage(String imgUrl) { try { super.loadImage(imgUrl); URL url = getClass().getClassLoader().getResource(imgUrl); if(url != null) return new ImageIcon(url).getImage(); } catch (Exception e) { e.printStackTrace(); } return null; } |
** You need to override the loadImage method because Eclipse 3+ sets a ContentHandlerFactory for URLConnections which doesn't seem capable of handling gif images, and so the url.getContent() method in the SimpleBeanInfo loadImage method does *not* return an ImageProducer, and hence the method does not return an image. The above method, however, does work in Eclipse 3.0+ because it does not depend on the url.getContent(). |