/branches/jsdoc_tk_gui/src/org/jsdoctoolkit/image/IconFactory.java
Java | 35 lines | 24 code | 10 blank | 1 comment | 5 complexity | 6f35cd4cbe8cf1267f646f678714710e MD5 | raw file
- package org.jsdoctoolkit.image;
-
- import java.net.URL;
-
- import javax.swing.ImageIcon;
-
- import org.jsdoctoolkit.model.MyLogger;
-
- public class IconFactory {
-
- public static String GIF = ".gif";
-
- public static String PNG = ".png";
-
- public static ImageIcon getImageIcon(String fileName, String fileType) {
-
- if (!"".equals(fileName)) {
-
- URL imageURL = IconFactory.class.getResource(fileName.toLowerCase()
- + fileType.toLowerCase());
-
- if(imageURL == null){
- //Gestion des images dans le Jar obfusqué
- imageURL = IconFactory.class.getResource("img/"
- + fileName.toLowerCase() + fileType.toLowerCase());
- }
- if (imageURL != null) {
- ImageIcon img = new ImageIcon(imageURL);
- return img;
- }
- }
- MyLogger.getLogger().info("Image not found !! : " + fileName + fileType);
- return null;
- }
- }