Statistics
| Revision:

svn-gvsig-desktop / trunk / prototypes / mobile / desktop / extensions / extExportMobile / src / es / prodevelop / gvsig / exportMobile / CreateImage.java @ 19196

History | View | Annotate | Download (993 Bytes)

1
package es.prodevelop.gvsig.exportMobile;
2

    
3
import java.net.URL;
4

    
5
import javax.swing.ImageIcon;
6

    
7
import org.apache.log4j.Logger;
8

    
9
/**
10
 * Class to access the icons used by the extension
11
 * @author amoreno
12
 *
13
 */
14
public class CreateImage {
15

    
16
        private Logger logger = Logger.getLogger(CreateImage.class.getClass());
17
        
18
        public CreateImage() {
19

    
20
        }
21

    
22
        /**
23
         * Get path image
24
         * 
25
         * @param path
26
         * @return URL
27
         */
28
        public java.net.URL createResourceUrl(String path) {
29
                return getClass().getClassLoader().getResource(path);
30
        }
31

    
32
        /**
33
         * Create image icon
34
         * 
35
         * @param path
36
         *            where the image is into.
37
         * @param description
38
         *            of the image.
39
         * @return ImageIcon
40
         */
41
        public ImageIcon createImageIcon(URL path, String description) {
42

    
43
                java.net.URL imgURL = path;
44
                if (imgURL != null) {
45
                        return new ImageIcon(imgURL, description);
46
                } else {
47
                        logger.error("Couldn't find file: " + path);
48
                        return null;
49
                }
50
        }
51

    
52
}