diff options
Diffstat (limited to 'src/demos/nurbs/icons/IconFactory.java')
-rwxr-xr-x | src/demos/nurbs/icons/IconFactory.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/demos/nurbs/icons/IconFactory.java b/src/demos/nurbs/icons/IconFactory.java new file mode 100755 index 0000000..81c906a --- /dev/null +++ b/src/demos/nurbs/icons/IconFactory.java @@ -0,0 +1,19 @@ +package demos.nurbs.icons; + +import com.sun.opengl.impl.io.StreamUtil; +import java.io.*; +import javax.swing.ImageIcon; + +public class IconFactory { + private IconFactory() {} + + public static ImageIcon getIcon(String resourceName) { + try { + InputStream input = IconFactory.class.getClassLoader().getResourceAsStream(resourceName); + byte[] data = StreamUtil.readAll2Array(input); + return new ImageIcon(data, resourceName); + } catch (IOException e) { + return new ImageIcon(); + } + } +} |