summaryrefslogtreecommitdiffstats
path: root/src/demos/nurbs/icons/IconFactory.java
blob: 81c906abdd5bdc420f4356fa58182b15da55d545 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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();
    }
  }
}