PageRenderTime 8ms CodeModel.GetById 4ms RepoModel.GetById 1ms app.codeStats 0ms

/branches/jsdoc_tk_gui/src/org/jsdoctoolkit/image/IconFactory.java

http://jsdoc-toolkit.googlecode.com/
Java | 35 lines | 24 code | 10 blank | 1 comment | 5 complexity | 6f35cd4cbe8cf1267f646f678714710e MD5 | raw file
  1. package org.jsdoctoolkit.image;
  2. import java.net.URL;
  3. import javax.swing.ImageIcon;
  4. import org.jsdoctoolkit.model.MyLogger;
  5. public class IconFactory {
  6. public static String GIF = ".gif";
  7. public static String PNG = ".png";
  8. public static ImageIcon getImageIcon(String fileName, String fileType) {
  9. if (!"".equals(fileName)) {
  10. URL imageURL = IconFactory.class.getResource(fileName.toLowerCase()
  11. + fileType.toLowerCase());
  12. if(imageURL == null){
  13. //Gestion des images dans le Jar obfusqué
  14. imageURL = IconFactory.class.getResource("img/"
  15. + fileName.toLowerCase() + fileType.toLowerCase());
  16. }
  17. if (imageURL != null) {
  18. ImageIcon img = new ImageIcon(imageURL);
  19. return img;
  20. }
  21. }
  22. MyLogger.getLogger().info("Image not found !! : " + fileName + fileType);
  23. return null;
  24. }
  25. }