KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antlr > works > utils > IconManager


1 /*
2
3 [The "BSD licence"]
4 Copyright (c) 2005 Jean Bovet
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
9 are met:
10
11 1. Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16 3. The name of the author may not be used to endorse or promote products
17 derived from this software without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 */

31
32 package org.antlr.works.utils;
33
34 import javax.swing.*;
35 import java.util.HashMap JavaDoc;
36 import java.util.Map JavaDoc;
37
38 public class IconManager {
39
40     private static final String JavaDoc path = "org/antlr/works/icons/";
41
42     private static IconManager shared = new IconManager();
43     private static Map JavaDoc<String JavaDoc,ImageIcon> cache = new HashMap JavaDoc<String JavaDoc, ImageIcon>();
44
45     public static IconManager shared() {
46         return shared;
47     }
48
49     public ImageIcon createImageIcon(String JavaDoc path) {
50         ImageIcon image = cache.get(path);
51         if(image == null) {
52             java.net.URL JavaDoc imgURL = this.getClass().getClassLoader().getResource(path);
53             image = imgURL != null ? new ImageIcon(imgURL) : null;
54             if(image != null)
55                 cache.put(path, image);
56         }
57         return image;
58     }
59
60     public ImageIcon getIconApplication() {
61         return createImageIcon(path+"app.png");
62     }
63
64     public ImageIcon getIconApplication32x32() {
65         return createImageIcon(path+"app_32x32.png");
66     }
67
68     public ImageIcon getIconApplication16x16() {
69         return createImageIcon(path+"app_16x16.png");
70     }
71
72     public ImageIcon getIconWarning() {
73         return createImageIcon(path+"warning.png");
74     }
75
76     public ImageIcon getIconColoring() {
77         return createImageIcon(path+"coloring.png");
78     }
79
80     public ImageIcon getIconSort() {
81         return createImageIcon(path+"sort.png");
82     }
83
84     public ImageIcon getIconSyntaxDiagram() {
85         return createImageIcon(path+"sd.png");
86     }
87
88     public ImageIcon getIconGraph() {
89         return createImageIcon(path+"graph.png");
90     }
91
92     public ImageIcon getIconListTree() {
93         return createImageIcon(path+"listtree.png");
94     }
95
96     public ImageIcon getIconIdea() {
97         return createImageIcon(path+"warning.png");
98     }
99
100     public ImageIcon getIconFind() {
101         return createImageIcon(path+"find.png");
102     }
103
104     public ImageIcon getIconBackward() {
105         return createImageIcon(path+"back.png");
106     }
107
108     public ImageIcon getIconForward() {
109         return createImageIcon(path+"forward.png");
110     }
111
112     public ImageIcon getIconDebug() {
113         return createImageIcon(path+"debug.png");
114     }
115
116     public ImageIcon getIconDebugAgain() {
117         return createImageIcon(path+"debug_again.png");
118     }
119
120     public ImageIcon getIconShowLinks() {
121         return createImageIcon(path+"show_links.png");
122     }
123
124     public ImageIcon getIconRun() {
125         return createImageIcon(path+"run.png");
126     }
127
128     public ImageIcon getIconAttach() {
129         return createImageIcon(path+"attach.png");
130     }
131
132     public ImageIcon getIconDetach() {
133         return createImageIcon(path+"detach.png");
134     }
135
136     public ImageIcon getIconExpandAll() {
137         return createImageIcon(path+"expandall.png");
138     }
139
140     public ImageIcon getIconCollapseAll() {
141         return createImageIcon(path+"collapseall.png");
142     }
143
144     public ImageIcon getIconCollapse() {
145         return createImageIcon(path+"collapse.png");
146     }
147
148     public ImageIcon getIconCollapseDown() {
149         return createImageIcon(path+"collapsedown.png");
150     }
151
152     public ImageIcon getIconCollapseUp() {
153         return createImageIcon(path+"collapseup.png");
154     }
155
156     public ImageIcon getIconExpand() {
157         return createImageIcon(path+"expand.png");
158     }
159
160     public ImageIcon getIconDelimiter() {
161         return createImageIcon(path+"delimiter.png");
162     }
163
164     public ImageIcon getIconDelimiterUp() {
165         return createImageIcon(path+"delimiterup.png");
166     }
167
168     public ImageIcon getIconDelimiterDown() {
169         return createImageIcon(path+"delimiterdown.png");
170     }
171
172     public ImageIcon getIconStop() {
173         return createImageIcon(path+"stop.png");
174     }
175
176     public ImageIcon getIconStepForward() {
177         return createImageIcon(path+"stepforward.png");
178     }
179
180     public ImageIcon getIconStepBackward() {
181         return createImageIcon(path+"stepbackward.png");
182     }
183
184     public ImageIcon getIconStepOver() {
185         return createImageIcon(path+"stepover.png");
186     }
187
188     public ImageIcon getIconGoToStart() {
189         return createImageIcon(path+"gotostart.png");
190     }
191
192     public ImageIcon getIconGoToEnd() {
193         return createImageIcon(path+"gotoend.png");
194     }
195
196     public ImageIcon getIconFastForward() {
197         return createImageIcon(path+"fastforward.png");
198     }
199
200     public ImageIcon getIconParser() {
201         return createImageIcon(path+"parser.png");
202     }
203
204     public ImageIcon getIconLexer() {
205         return createImageIcon(path+"lexer.png");
206     }
207
208 }
209
Popular Tags