1 29 38 39 package org.planetamessenger.mos.engine; 40 41 import java.util.*; 42 import java.util.jar.*; 43 import javax.swing.*; 44 import org.planetamessenger.ui.*; 45 import org.planetamessenger.plugin.*; 46 47 48 public class JResources { 49 50 static public final int DEFAULT_BUTTON_WIDTH = 110; 51 static public final int DEFAULT_BUTTON_HEIGHT = 40; 52 static public final int BUTTON_WIDTH_16 = 16; 53 static public final int BUTTON_HEIGHT_16 = 16; 54 static public final int ICON_WIDTH_16 = 16; 55 static public final int ICON_HEIGHT_16 = 16; 56 static public final int ICON_WIDTH_32 = 32; 57 static public final int ICON_HEIGHT_32 = 32; 58 59 static public final int SPLASH_WINDOW_BACKGROUND = JPlugin.STATUS_LAST + 1; 60 static public final int LOADING_ICON = JPlugin.STATUS_LAST + 2; 61 static public final int MESSAGE_BLINK = JPlugin.STATUS_LAST + 3; 62 static public final int ADD_INVITE_ICON = JPlugin.STATUS_LAST + 4; 63 static public final int MY_MESSENGER_ICON = JPlugin.STATUS_LAST + 5; 64 static public final int EXIT_ICON = JPlugin.STATUS_LAST + 6; 65 static public final int REMOVE_ICON = JPlugin.STATUS_LAST + 7; 66 static public final int ABOUT_ICON = JPlugin.STATUS_LAST + 8; 67 static public final int SETTINGS_ICON = JPlugin.STATUS_LAST + 9; 68 static public final int MESSAGE_ICON = JPlugin.STATUS_LAST + 10; 69 static public final int ACCOUNTS_ICON = JPlugin.STATUS_LAST + 11; 70 static public final int CONTACTS_ICON = JPlugin.STATUS_LAST + 12; 71 static public final int PROFILE_ICON = JPlugin.STATUS_LAST + 13; 72 static public final int CONSOLE_ICON = JPlugin.STATUS_LAST + 14; 73 static public final int SEND_IM_ICON = JPlugin.STATUS_LAST + 15; 74 static public final int USER_DETAIL_ICON = JPlugin.STATUS_LAST + 16; 75 static public final int OK_BUTTON_ICON = JPlugin.STATUS_LAST + 17; 76 static public final int CLOSE_BUTTON_ICON = JPlugin.STATUS_LAST + 18; 77 static public final int UPDATE_NAME_ICON = JPlugin.STATUS_LAST + 19; 78 static public final int APPLICATION_ICON = JPlugin.STATUS_LAST + 20; 79 static public final int PROXY_SETTINGS_ICON = JPlugin.STATUS_LAST + 21; 80 static public final int NEW_ICON = JPlugin.STATUS_LAST + 22; 81 static public final int RENAME_ICON = JPlugin.STATUS_LAST + 23; 82 static public final int ADD_PLUGIN_ICON = JPlugin.STATUS_LAST + 24; 83 static public final int REMOVE_PLUGIN_ICON = JPlugin.STATUS_LAST + 25; 84 static public final int APPLY_BUTTON_ICON = JPlugin.STATUS_LAST + 26; 85 static public final int REMOVE_FILE_ICON = JPlugin.STATUS_LAST + 27; 86 static public final int PLUGIN_ICON = JPlugin.STATUS_LAST + 28; 87 static public final int LOOKNFEEL_ICON = JPlugin.STATUS_LAST + 29; 88 static public final int RELOAD_ICON = JPlugin.STATUS_LAST + 30; 89 static public final int LANGUAGE_ICON = JPlugin.STATUS_LAST + 31; 90 static public final int CLOSE_TAB_ICON = JPlugin.STATUS_LAST + 32; 91 static public final int LOADING_STARTUP_ICON = JPlugin.STATUS_LAST + 33; 92 static public final int INSTALL_PLUGIN_ICON = JPlugin.STATUS_LAST + 34; 93 static public final int UNINSTALL_PLUGIN_ICON = JPlugin.STATUS_LAST + 35; 94 static public final int LOADING_32_ICON = JPlugin.STATUS_LAST + 36; 95 static public final int BLOCK_16_ICON = JPlugin.STATUS_LAST + 37; 96 static public final int UNBLOCK_16_ICON = JPlugin.STATUS_LAST + 38; 97 98 String strResPath; 99 HashMap<Integer , Icon> hIconsList = null; 100 HashMap<Integer , Icon> hImagesList = null; 101 102 103 108 public JResources( String strResourcesPath ) { 109 110 strResPath = strResourcesPath; 111 112 loadIcons(); 113 loadImages(); 114 } 115 116 120 public javax.swing.ImageIcon getIcon( int nIcon ) { 121 122 return ( javax.swing.ImageIcon ) hIconsList.get( new Integer ( nIcon ) ); 123 } 124 125 129 public javax.swing.ImageIcon getImage( int nImage ) { 130 131 return ( javax.swing.ImageIcon ) hImagesList.get( new Integer ( nImage ) ); 132 } 133 134 137 private void loadIcons() { 138 139 String strJarFile = strResPath + "icons.jar"; 140 141 142 hIconsList = new HashMap<Integer , Icon>(); 143 hIconsList.put( new Integer ( JPlugin.STATUS_OFFLINE ), JImage.loadIconFromJar( strJarFile, "icons/offline.gif" ) ); 144 hIconsList.put( new Integer ( JPlugin.STATUS_ONLINE ), JImage.loadIconFromJar( strJarFile, "icons/online.gif" ) ); 145 hIconsList.put( new Integer ( JPlugin.STATUS_CUSTOM ), JImage.loadIconFromJar( strJarFile, "icons/online.gif" ) ); 146 hIconsList.put( new Integer ( JPlugin.STATUS_FREE_CHAT ), JImage.loadIconFromJar( strJarFile, "icons/freeforchat.gif" ) ); 147 hIconsList.put( new Integer ( JPlugin.STATUS_INVISIBLE ), JImage.loadIconFromJar( strJarFile, "icons/invisible.gif" ) ); 148 hIconsList.put( new Integer ( JPlugin.STATUS_AWAY ), JImage.loadIconFromJar( strJarFile, "icons/away.gif" ) ); 149 hIconsList.put( new Integer ( JPlugin.STATUS_IDLE ), JImage.loadIconFromJar( strJarFile, "icons/away.gif" ) ); 150 hIconsList.put( new Integer ( JPlugin.STATUS_BUSY ), JImage.loadIconFromJar( strJarFile, "icons/busy.gif" ) ); 151 hIconsList.put( new Integer ( JPlugin.STATUS_DND ), JImage.loadIconFromJar( strJarFile, "icons/dnd.gif" ) ); 152 hIconsList.put( new Integer ( JPlugin.STATUS_ON_PHONE ), JImage.loadIconFromJar( strJarFile, "icons/onphone.gif" ) ); 153 hIconsList.put( new Integer ( JPlugin.STATUS_ON_LUNCH ), JImage.loadIconFromJar( strJarFile, "icons/onlunch.gif" ) ); 154 hIconsList.put( new Integer ( JPlugin.STATUS_NOT_AT_HOME ), JImage.loadIconFromJar( strJarFile, "icons/notathome.gif" ) ); 155 hIconsList.put( new Integer ( JPlugin.STATUS_NOT_IN_OFFICE ), JImage.loadIconFromJar( strJarFile, "icons/notinoffice.gif" ) ); 156 hIconsList.put( new Integer ( JPlugin.STATUS_NOT_AT_DESK ), JImage.loadIconFromJar( strJarFile, "icons/notatdesk.gif" ) ); 157 hIconsList.put( new Integer ( JPlugin.STATUS_ON_VACATION ), JImage.loadIconFromJar( strJarFile, "icons/onvacation.gif" ) ); 158 hIconsList.put( new Integer ( JPlugin.STATUS_MESSAGE ), JImage.loadIconFromJar( strJarFile, "icons/message.gif" ) ); 159 hIconsList.put( new Integer ( JPlugin.STATUS_URL ), JImage.loadIconFromJar( strJarFile, "icons/url.gif" ) ); 160 hIconsList.put( new Integer ( JPlugin.STATUS_NOT_IN_LIST ), JImage.loadIconFromJar( strJarFile, "icons/notinlist.gif" ) ); 161 hIconsList.put( new Integer ( LOADING_ICON ), JImage.loadIconFromJar( strJarFile, "icons/loading.gif" ) ); 162 hIconsList.put( new Integer ( MESSAGE_BLINK ), JImage.loadIconFromJar( strJarFile, "icons/message_blink.gif" ) ); 163 hIconsList.put( new Integer ( ADD_INVITE_ICON ), JImage.loadIconFromJar( strJarFile, "icons/add_invite_16.gif" ) ); 164 hIconsList.put( new Integer ( MY_MESSENGER_ICON ), JImage.loadIconFromJar( strJarFile, "icons/my_messenger_16.gif" ) ); 165 hIconsList.put( new Integer ( EXIT_ICON ), JImage.loadIconFromJar( strJarFile, "icons/exit_16.gif" ) ); 166 hIconsList.put( new Integer ( REMOVE_ICON ), JImage.loadIconFromJar( strJarFile, "icons/remove_16.gif" ) ); 167 hIconsList.put( new Integer ( ABOUT_ICON ), JImage.loadIconFromJar( strJarFile, "icons/about_16.gif" ) ); 168 hIconsList.put( new Integer ( SETTINGS_ICON ), JImage.loadIconFromJar( strJarFile, "icons/settings_16.gif" ) ); 169 hIconsList.put( new Integer ( MESSAGE_ICON ), JImage.loadIconFromJar( strJarFile, "icons/message_16.gif" ) ); 170 hIconsList.put( new Integer ( ACCOUNTS_ICON ), JImage.loadIconFromJar( strJarFile, "icons/accounts_16.gif" ) ); 171 hIconsList.put( new Integer ( CONTACTS_ICON ), JImage.loadIconFromJar( strJarFile, "icons/contacts_16.gif" ) ); 172 hIconsList.put( new Integer ( PROFILE_ICON ), JImage.loadIconFromJar( strJarFile, "icons/profile_16.gif" ) ); 173 hIconsList.put( new Integer ( CONSOLE_ICON ), JImage.loadIconFromJar( strJarFile, "icons/terminal_16.gif" ) ); 174 hIconsList.put( new Integer ( SEND_IM_ICON ), JImage.loadIconFromJar( strJarFile, "icons/sendmessage_24.gif" ) ); 175 hIconsList.put( new Integer ( USER_DETAIL_ICON ), JImage.loadIconFromJar( strJarFile, "icons/userdetail_16.gif" ) ); 176 hIconsList.put( new Integer ( OK_BUTTON_ICON ), JImage.loadIconFromJar( strJarFile, "icons/ok_24.gif" ) ); 177 hIconsList.put( new Integer ( CLOSE_BUTTON_ICON ), JImage.loadIconFromJar( strJarFile, "icons/close_24.gif" ) ); 178 hIconsList.put( new Integer ( UPDATE_NAME_ICON ), JImage.loadIconFromJar( strJarFile, "icons/refresh_16.gif" ) ); 179 hIconsList.put( new Integer ( APPLICATION_ICON ), JImage.loadIconFromJar( strJarFile, "icons/planet_24.gif" ) ); 180 hIconsList.put( new Integer ( PROXY_SETTINGS_ICON ), JImage.loadIconFromJar( strJarFile, "icons/proxy_settings_16.gif" ) ); 181 hIconsList.put( new Integer ( NEW_ICON ), JImage.loadIconFromJar( strJarFile, "icons/new_24.gif" ) ); 182 hIconsList.put( new Integer ( RENAME_ICON ), JImage.loadIconFromJar( strJarFile, "icons/rename_16.gif" ) ); 183 hIconsList.put( new Integer ( ADD_PLUGIN_ICON ), JImage.loadIconFromJar( strJarFile, "icons/add_plugin_24.gif" ) ); 184 hIconsList.put( new Integer ( REMOVE_PLUGIN_ICON ), JImage.loadIconFromJar( strJarFile, "icons/remove_plugin_24.gif" ) ); 185 hIconsList.put( new Integer ( APPLY_BUTTON_ICON ), JImage.loadIconFromJar( strJarFile, "icons/apply_24.gif" ) ); 186 hIconsList.put( new Integer ( REMOVE_FILE_ICON ), JImage.loadIconFromJar( strJarFile, "icons/remove_24.gif" ) ); 187 hIconsList.put( new Integer ( PLUGIN_ICON ), JImage.loadIconFromJar( strJarFile, "icons/plugin_16.gif" ) ); 188 hIconsList.put( new Integer ( LOOKNFEEL_ICON ), JImage.loadIconFromJar( strJarFile, "icons/looknfeel_16.gif" ) ); 189 hIconsList.put( new Integer ( RELOAD_ICON ), JImage.loadIconFromJar( strJarFile, "icons/reload_24.gif" ) ); 190 hIconsList.put( new Integer ( LANGUAGE_ICON ), JImage.loadIconFromJar( strJarFile, "icons/looknfeel_16.gif" ) ); 192 hIconsList.put( new Integer ( CLOSE_TAB_ICON ), JImage.loadIconFromJar( strJarFile, "icons/close_tab_16.gif" ) ); 194 hIconsList.put( new Integer ( LOADING_STARTUP_ICON ), JImage.loadIconFromJar( strJarFile, "icons/loading_classic.gif" ) ); 195 hIconsList.put( new Integer ( INSTALL_PLUGIN_ICON ), JImage.loadIconFromJar( strJarFile, "icons/install_plugin_16.png" ) ); 196 hIconsList.put( new Integer ( UNINSTALL_PLUGIN_ICON ), JImage.loadIconFromJar( strJarFile, "icons/uninstall_plugin_16.png" ) ); 197 hIconsList.put( new Integer ( LOADING_32_ICON ), JImage.loadIconFromJar( strJarFile, "icons/loading_32.gif" ) ); 198 hIconsList.put( new Integer ( BLOCK_16_ICON ), JImage.loadIconFromJar( strJarFile, "icons/block_16.png" ) ); 199 hIconsList.put( new Integer ( UNBLOCK_16_ICON ), JImage.loadIconFromJar( strJarFile, "icons/unblock_16.png" ) ); 200 } 201 202 205 private void loadImages() { 206 207 String strJarFile = strResPath + "images.jar"; 208 209 hImagesList = new HashMap<Integer , Icon>(); 210 hImagesList.put( new Integer ( SPLASH_WINDOW_BACKGROUND ), JImage.loadIconFromJar( strJarFile, "images/splash_window.gif" ) ); 211 } 212 } 213 214 | Popular Tags |