Invisible frame icon

Hi, I have done most of the tutorials so I'm trying to do my first game. However, I can't change the frame icon. When I supply both 1616 and 3232 icons the default icon just becomes invisible.  I'm using widows so I followed instructions from javadoc "On Windows you should supply at least one 16x16 image and one 32x32." The code used for loading images:

  public static Image getImage(String file)      {
     try {
     BufferedImage im = File(file));

       int transparency = im.getColorModel().getTransparency();
       BufferedImage copy =   GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(
                                im.getWidth(), im.getHeight(),
       ImageGraphics gfx = ImageGraphics.createInstance(copy.getWidth(),copy.getHeight(), 0);
       return gfx.getImage();
     catch(IOException e) {
       return null;

In my case, TGA image format is used. (because it supports alpha channel)

The code below works well for me. (not tested on mac)

   public static OSType probeOS() {
      final String os = System.getProperty("");
      if (os.startsWith("Linux"))
         return OSType.LINUX;
      else if (os.startsWith("Mac"))
         return OSType.MAC;
      return OSType.WINDOWS;

    * @param small      both of width, height is 16. used by windows
    * @param medium   both of width, height is 32. used by windows, linux
    * @param large      both of width, height is 128. used by mac
    * @throws IOException
   public static void setIcon(final String small, final String medium, final String large) throws IOException {
      final OSType osType = probeOS();
      Image[] icons = null;
      switch (osType) {
         case LINUX:
            final Image linuxIcon = createIcon(medium);
            icons = new Image[] {
         case MAC:
            final Image macIcon = createIcon(large);
            icons = new Image[] {
         default: // windows
            final Image winIcon1 = createIcon(small);
            final Image winIcon2 = createIcon(medium);
            icons = new Image[] {
                  winIcon1, winIcon2

   private static Image createIcon(final String path) throws IOException {
      final InputStream in = SystemProbe.class.getResourceAsStream(path);
      final Image icon = TGALoader.loadImage(in);
      return icon;

Thanks, your code worked, except that I had to use FileInputStream instead of .getResourceAsStream(), otherwise I got Stream closed exceptions.