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

nullpointerexception in AWT when application sets IconImage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.7
    • client-libs
    • None
    • sparc
    • solaris_2.6


      the AWT falls over when applications set Frame.setIconImage().

      adding the following code to an AWT application causes the error.

      rpnframe is the frame created by the application for its GUI.

      {
      Image icon_img;
      java.net.URL url;

      // really, any application level class will do here
      url = (new myMouseListener()).getClass().getResource("caveh.gif");
      if (url != null) {
      icon_img = Toolkit.getDefaultToolkit().getImage(url);
      if (icon_img != null)
      rpnframe.setIconImage(icon_img);
      }
      }

      =================

      3.zeta$ j rpncalc
      java.lang.NullPointerException
      at sun.awt.motif.MFramePeer.setIconImage(MFramePeer.java:113)
      at sun.awt.motif.MFramePeer.<init>(MFramePeer.java:87)
      at sun.awt.motif.MToolkit.createFrame(MToolkit.java:117)
      at java.awt.Frame.addNotify(Frame.java:203)
      at java.awt.Window.show(Window.java:145)
      at java.awt.Component.show(Component.java:501)
      at java.awt.Component.setVisible(Component.java:463)
      at rpncalc.main(rpncalc.java:43)
      3.zeta$ j -version
      java version "1.1.7"
      3.zeta$

            mbronsonsunw Mike Bronson (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: