Java Code Examples for sun.swing.SwingUtilities2#makeIcon_Unprivileged()

The following examples show how to use sun.swing.SwingUtilities2#makeIcon_Unprivileged() . 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: LookAndFeel.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Creates and returns a {@code UIDefault.LazyValue} that loads an
 * image. The returned value is an implementation of {@code
 * UIDefaults.LazyValue}. When {@code createValue} is invoked on
 * the returned object, the image is loaded. If the image is {@code
 * non-null}, it is then wrapped in an {@code Icon} that implements {@code
 * UIResource}. The image is loaded using {@code
 * Class.getResourceAsStream(gifFile)}.
 * <p>
 * This method does not check the arguments in any way. It is
 * strongly recommended that {@code non-null} values are supplied else
 * exceptions may occur when {@code createValue} is invoked on the
 * returned object.
 *
 * @param baseClass {@code Class} used to load the resource
 * @param gifFile path to the image to load
 * @return a {@code UIDefaults.LazyValue}; when resolved the
 *         {@code LazyValue} loads the specified image
 * @see UIDefaults.LazyValue
 * @see Icon
 * @see Class#getResourceAsStream(String)
 */
public static Object makeIcon(final Class<?> baseClass, final String gifFile) {
    return SwingUtilities2.makeIcon_Unprivileged(baseClass, baseClass, gifFile);
}
 
Example 2
Source File: LookAndFeel.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates and returns a {@code UIDefault.LazyValue} that loads an
 * image. The returned value is an implementation of {@code
 * UIDefaults.LazyValue}. When {@code createValue} is invoked on
 * the returned object, the image is loaded. If the image is {@code
 * non-null}, it is then wrapped in an {@code Icon} that implements {@code
 * UIResource}. The image is loaded using {@code
 * Class.getResourceAsStream(gifFile)}.
 * <p>
 * This method does not check the arguments in any way. It is
 * strongly recommended that {@code non-null} values are supplied else
 * exceptions may occur when {@code createValue} is invoked on the
 * returned object.
 *
 * @param baseClass {@code Class} used to load the resource
 * @param gifFile path to the image to load
 * @return a {@code UIDefaults.LazyValue}; when resolved the
 *         {@code LazyValue} loads the specified image
 * @see UIDefaults.LazyValue
 * @see Icon
 * @see Class#getResourceAsStream(String)
 */
public static Object makeIcon(final Class<?> baseClass, final String gifFile) {
    return SwingUtilities2.makeIcon_Unprivileged(baseClass, baseClass, gifFile);
}