Java Code Examples for org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities#getClassLoaderForResources()
The following examples show how to use
org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities#getClassLoaderForResources() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BrushedMetalDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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, 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("org/pushingpixels/substance/internal/image/brushed.gif"); this.originalTile = ImageIO.read(metalUrl); } catch (Exception exc) { // ignore - probably specified incorrect file // or file is not image } }
Example 2
Source File: SubstanceKatakanaWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the font instance from the bundled resource. * * @return Font instance from the bundled resource. */ private static Font getFont() { // the following is fix by Dag Joar and Christian Schlichtherle // for application running with -Xbootclasspath VM flag. In this case, // 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(); InputStream is = cl.getResourceAsStream( "org/pushingpixels/substance/extras/api/watermarkpack/katakana.ttf"); if (is != null) { try { Font kf = Font.createFont(Font.TRUETYPE_FONT, is); int fontSize = 14; return kf.deriveFont(Font.BOLD, fontSize); } catch (Exception exc) { } } return null; }
Example 3
Source File: SubstanceBrushedMetalWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Creates a new <code>Brushed Metal</code> watermark. */ public SubstanceBrushedMetalWatermark() { try { ClassLoader cl = SubstanceCoreUtilities.getClassLoaderForResources(); URL metalUrl = cl .getResource( "org/pushingpixels/substance/extras/api/watermarkpack/brushed.gif"); this.brushedMetalTile = ImageIO.read(metalUrl); } catch (Exception exc) { // ignore - probably specified incorrect file // or file is not image } }