1 31 32 package org.antlr.works.utils; 33 34 import javax.swing.*; 35 import java.util.HashMap ; 36 import java.util.Map ; 37 38 public class IconManager { 39 40 private static final String path = "org/antlr/works/icons/"; 41 42 private static IconManager shared = new IconManager(); 43 private static Map <String ,ImageIcon> cache = new HashMap <String , ImageIcon>(); 44 45 public static IconManager shared() { 46 return shared; 47 } 48 49 public ImageIcon createImageIcon(String path) { 50 ImageIcon image = cache.get(path); 51 if(image == null) { 52 java.net.URL 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 |