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

setIconImage works, then does not work.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.4, 1.1.5
    • client-libs
    • None
    • x86
    • windows_nt



      Name: paC48320 Date: 10/08/97


      The window opens with the SWMB.jpg as the icon(GOOD), Then when the window is minimized, the icon becomes ALERT.jpg(GOOD). Then when maximized, the icon becomes the default "coffee cup" (BAD), then when minimized icon stays as default "coffee cup"(WORSE). The icon never again becomes the jpg's they were in the beginning.

      import java.awt.*;

      public class test extends Frame
      {
      Button button;
      //OKDialog okd;

      public test(String title)
      {
      super(title);
      super.setIconImage(Toolkit.getDefaultToolkit().getImage("SWMB.jpg"));
      button = new Button("test");
      setLayout(null);
      button.resize(50,30);
      button.move(130,130);
      add(button);
      }

      public static void main(String[] args)
      {
      test icontest = new test("Change Icon");
      icontest.resize(300,300);
      icontest.show();
      }

      public boolean handleEvent(Event evt)
      {
      if (evt.id == Event.WINDOW_DESTROY)
      {
      System.exit(0);
      return true;
      }

      if (evt.id == Event.WINDOW_ICONIFY)
      {
      super.setIconImage(Toolkit.getDefaultToolkit().getImage("ALERT.jpg"));
      return true;
      }

      if (evt.id == Event.WINDOW_DEICONIFY)
      {
      super.setIconImage(Toolkit.getDefaultToolkit().getImage("SWMB.jpg"));
      return true;
      }

      /*if ((evt.target == button) && (evt.id == Event.ACTION_EVENT))
      {
      if (showDialog())
      System.exit(0);

      return true;
      }*/

      return super.handleEvent(evt);
      }

      /*public boolean showDialog()
      {
      okd = new OKDialog(this,"Warning - Shutdown of the Message Board will prevent broadcast information from reaching your system!");
      okd.show();

      return (okd.getButtonValue());
      }*/
      }

      Also:

      1. This behavior occurs when using MS's Visual J++ 1.1 compiler, but using JDK1.1.4's classes.zip and VM.
      2. When using all MS compiler,VM, and classes.zip the icon never changes at all. It
      remains the "coffee cup" The same is true if I use all JDK1.1.4.
      3. I have also tried with three images. I changes the icon successfully each time, but as soon as
      I change it to an icon that was previously displayed, i get the coffee cup.
      ======================================================================

            Unassigned Unassigned
            pallenba Peter Allenbach (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: