/** * Gets the location of the given image resource path as an URL. * <p>Note that this method only works for images found in the classpath of the class loader which loaded this {@link UIUtils} class. * If you are not sure, you should better use {@link #getImageURL(String, Class)}.</p> * * @param resourcePath the resource path * * @return an URL representing the given resource path or <code>null</code> if it could not be found */ public static URL getImageURL(String resourcePath) { return getImageURL(resourcePath, UIUtils.class); }
/** * Gets the image icon loaded from the given resource path. * * @param resourcePath the resource path * @param callerClass the class which calls this method and therefore provides the class loader for the requested resource * * @return an image icon loaded from the given resource path or <code>null</code> if it could not be found * @since 4.0 */ public static ImageIcon loadImageIcon(String resourcePath, Class callerClass) { if (StringUtils.isNotNullAndNotEmpty(resourcePath)) { URL location = getImageURL(resourcePath, callerClass); return (location != null) ? new ImageIcon(location) : null; } return null; }
private EditNameAssociationAction() { URL viewIconImageURL = UIUtils.getImageURL("/org/esa/beam/timeseries/ui/icons/timeseries-combvar24.png", TimeSeriesManagerForm.class); putValue(LARGE_ICON_KEY, new ImageIcon(viewIconImageURL)); putValue(SHORT_DESCRIPTION, "Edit names association"); }
private ViewTimeSeriesButtonAction() { URL viewIconImageURL = UIUtils.getImageURL("/org/esa/beam/timeseries/ui/icons/timeseries-view24.png", TimeSeriesManagerForm.class); putValue(LARGE_ICON_KEY, new ImageIcon(viewIconImageURL)); putValue(SHORT_DESCRIPTION, "View Time Series"); }
EditTimeSpanAction(AbstractTimeSeries timeSeries) { this.timeSeries = timeSeries; setEnabled(timeSeries != null); // putValue(NAME, "[?]"); // todo set name URL editTimeSpanIconImageURL = UIUtils.getImageURL("/org/esa/beam/timeseries/ui/icons/timeseries-rangeedit24.png", EditTimeSpanAction.class); putValue(LARGE_ICON_KEY, new ImageIcon(editTimeSpanIconImageURL)); putValue(ACTION_COMMAND_KEY, getClass().getName()); putValue(SHORT_DESCRIPTION, "Edit time span"); putValue("componentName", "EditTimeSpan"); }