Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4175560

setIconImage no longer handles transparent GIFs

XMLWordPrintable

    • kestrel
    • x86
    • generic, windows_95, windows_nt



      Name: el35337 Date: 09/22/98


      Erik,

      Run this program ("BadIcon.java", attached) with JDK 1.2 and JDK 1.1.6
      on a Windows NT platform. (It may be a problem on all platforms.)

      The frame's Icon (on Windows, shown in the task bar and in the window's
      title bar) has a black background under JDK 1.2, but in JDK 1.1.6, it is
      correctly transparent.

      Something new you are doing in JDK 1.2 does not handle the GIF
      transparent pixels correctly using Frame.setIconImage().

      This is still a problem with JDK 1.2 beta 4.1.

      Here is the code. I forwarded the code and the
      GIF image to Erik Larsen. (I don't know how to
      include the image in this form :-) But if you
      have a 32x32 transparent GIF to test with, then
      use that.
      --

      import java.awt.*;
      import java.awt.image.*;
      import java.io.*;
      import java.net.*;

      public class BadIcon {

          public static void main(String[] args) {
              Image image;
              try {
                  URL url = BadIcon.class.getResource("leif32.gif");
                  Toolkit tk = Toolkit.getDefaultToolkit();
                  image = tk.createImage((ImageProducer)url.getContent());

                  Frame frame = new Frame();
                  frame.setIconImage(image);
                  frame.show();
              } catch (Exception e) {
                  System.err.println("Error loading ImageIcon "+BadIcon.class.getResou
      rce("leif32.gif"));
                  e.printStackTrace();
              }
          }
      }

      --
      Thanks,
      Rich
      (Review ID: 39230)
      ======================================================================

      Name: rlT66838 Date: 09/23/99


      whenn setting frame icon image using transparent GIF
      transperent color is replaced with black.
      (Review ID: 95609)
      ======================================================================

            bchristi Brent Christian
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: