public static ResizableIcon getActionIcon(final AFreeplaneAction action) { ResizableIcon icon = null; ImageIcon ico = (ImageIcon) action.getValue(Action.SMALL_ICON); if (ico != null) { icon = ImageWrapperResizableIcon.getIcon( ico.getImage(), new Dimension(ico.getIconWidth(), ico.getIconHeight())); } else { String resource = ResourceController.getResourceController().getProperty(action.getIconKey(), null); if (resource != null) { URL location = ResourceController.getResourceController().getResource(resource); icon = ImageWrapperResizableIcon.getIcon(location, new Dimension(16, 16)); } } if (icon == null) { icon = RibbonActionContributorFactory.BLANK_ACTION_ICON; } return icon; }
public static ResizableIcon getRibbonIcon(String name, int width, int height) { // String key=name+"-"+width+"-"+height; // ResizableIcon icon = (ResizableIcon) ribbonIcons.get(key); //don't store ResizableIcon icon = null; // if (icon == null) { URL url = getURL(name); if (url == null) return null; icon = ImageWrapperResizableIcon.getIcon(url, new Dimension(width, height)); // ribbonIcons.put(key, icon); // } return icon; }