Map<String, Object> getDefaultsForPrefix(String prefix) { if (compiledDefaults == null) { compiledDefaults = new HashMap<String, Map<String, Object>>(); for (Map.Entry<Object, Object> entry : UIManager.getDefaults().entrySet()) { if (entry.getKey() instanceof String) { addDefault((String) entry.getKey(), entry.getValue()); } } if (!defaultListenerAdded) { UIManager.getDefaults().addPropertyChangeListener(defaultsListener); defaultListenerAdded = true; } } return compiledDefaults.get(prefix); }
/** * Check if developer changed icon in the UI table. * * @return the icon to use or {@code null} if the current one is to be used */ private Icon getLaFIcon() { // use icon from the UI table if it does not match this one. Icon rv = (Icon) UIManager.getDefaults().get(typeToString(type)); if (rv instanceof VistaMenuItemCheckIcon && ((VistaMenuItemCheckIcon) rv).type == type) { rv = null; } return rv; }
/** Called by UIManager when this look and feel is uninstalled. */ @Override public void uninitialize() { super.uninitialize(); defaults.uninitialize(); // clear all cached images to free memory ImageCache.getInstance().flush(); UIManager.getDefaults().removePropertyChangeListener(defaultsListener); }