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

JDialog.setIconImage(s)() doesn't properly set the alt-tab icon on WinXP

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 6
    • client-libs

      Dialog and JDialog behave differently with respect to setting the icon used in the alt-tab listing on Windows XP. This may also be true of other icon usages and/or other platforms. For instance on WinXP, only the AWT Dialog appears in the task bar.

      The included test demonstrates the problem. A Dialog and JDialog are setup identically. The icons are both set correctly in the title bars, however when you press alt-tab to switch between applications, you can see that the icon for the AWT Dialog is also the custom icon, but the JDialog's icon is still the default.

      I believe this is limited to the case of dialogs with null owners - otherwise, the owning frames's icon is the only one in the alt-tab list.

      This is a bug in new Mustang functionality - before Window.setIconImage() was added, there wasn't a way to set an icon directly on a (J)Dialog.

      // Test showing that setIconImage() doesn't set the alt-tab icon for JDialog,
      // yet does for Dialog
      import java.awt.*;
      import javax.swing.*;
      import javax.imageio.*;
      import java.io.*;

      public class JDialogSetIconBug {
          public static void main(String[] args) {
              try {
                  Dialog dialog = new Dialog((Frame)null, "AWT Dialog");
                  JDialog jdialog = new JDialog((Frame)null, "JDialog");
                  Image icon = ImageIO.read(new File("64x64.gif"));

                  dialog.setBounds(10, 200, 100, 100);
                  dialog.setIconImage(icon);

                  jdialog.setBounds(200, 200, 100, 100);
                  jdialog.setIconImage(icon);

                  dialog.setVisible(true);
                  jdialog.setVisible(true);
              }
              catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }

            mcherkas Mikhail Cherkasov (Inactive)
            bchristi Brent Christian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: