/** * Creates a new brushed metal decoration painter. */ public BrushedMetalDecorationPainter() { super(); try { // the following is fix by Dag Joar and Christian Schlichtherle // for application running with -Xbootclasspath VM flag. In this // case, the using MyClass.class.getClassLoader() would return // null, but the context class loader will function properly // that classes will be properly loaded regardless of whether // the lib is added to the system class path, the extension class // path and regardless of the class loader architecture set up by // some frameworks. ClassLoader cl = SubstanceCoreUtilities .getClassLoaderForResources(); URL metalUrl = cl.getResource("resource/brushed.gif"); this.originalTile = ImageIO.read(metalUrl); } catch (Exception exc) { // ignore - probably specified incorrect file // or file is not image } }
/** * Creates a new brushed metal decoration painter. */ public BrushedMetalDecorationPainter() { super(); try { // the following is fix by Dag Joar and Christian Schlichtherle // for application running with -Xbootclasspath VM flag. In this // case, the using MyClass.class.getClassLoader() would return // null, but the context class loader will function properly // that classes will be properly loaded regardless of whether // the lib is added to the system class path, the extension class // path and regardless of the class loader architecture set up by // some frameworks. ClassLoader cl = SubstanceCoreUtilities .getClassLoaderForResources(); URL metalUrl = cl.getResource("resource/brushed.gif"); this.originalTile = ImageIO.read(metalUrl); } catch (Exception exc) { // ignore - probably specified incorrect file // or file is not image } }
/** * Returns the collection of color schemes in the specified URL. * * @param resourceName * Name of the resource containing the description of Substance * color schemes. * @return The collection of color schemes in the specified URL. * @since version 6.0 */ public static ColorSchemes getColorSchemes(String resourceName) { ClassLoader cl = SubstanceCoreUtilities.getClassLoaderForResources(); return SubstanceColorSchemeUtilities.getColorSchemes(cl .getResource(resourceName)); } }
/** * Returns an icon pointed to by the specified string. * * @param iconResource * Resource location string. * @return Icon. */ public static Icon getIcon(String iconResource) { ClassLoader cl = getClassLoaderForResources(); URL iconUrl = cl.getResource(iconResource); if (iconUrl == null) return null; return new IconUIResource(new ImageIcon(iconUrl)); }
/** * Returns an icon pointed to by the specified string. * * @param iconResource * Resource location string. * @return Icon. */ public static Icon getIcon(String iconResource) { ClassLoader cl = getClassLoaderForResources(); URL iconUrl = cl.getResource(iconResource); if (iconUrl == null) return null; return new IconUIResource(new ImageIcon(iconUrl)); }
/** * Returns the collection of color schemes in the specified URL. * * @param resourceName * Name of the resource containing the description of Substance * color schemes. * @return The collection of color schemes in the specified URL. * @since version 6.0 */ public static ColorSchemes getColorSchemes(String resourceName) { ClassLoader cl = SubstanceCoreUtilities.getClassLoaderForResources(); return SubstanceColorSchemeUtilities.getColorSchemes(cl .getResource(resourceName)); } }