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

JApplet: NullPointerException on displayChanged when changing display settings

XMLWordPrintable

    • x86
    • windows_2000

      Name: gm110360 Date: 07/25/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Internet Explorer 5.5

      A DESCRIPTION OF THE PROBLEM :
      Changing display settings (e.g. color depth) while running
      an applet with JRE 1.4 (bug did not occur with 1.3.1),
      causes the colors of the applet to go weird and the
      (obviously back buffered) applet display stretches/shrinkes.

      The Java console shows the stack trace shown below.


      REGRESSION. Last worked in version 1.3

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. run applet with JRE 1.4 in IE 5.5
      2. change display settings
      3. cause applet repaints


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The applet is supposed to survive chaning display settings
      with no visual defects.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.NullPointerException
      at sun.awt.windows.WWindowPeer.displayChanged(WWindowPeer.java:154)
      at sun.awt.SunDisplayChanger.notifyListeners(SunDisplayChanger.java:102)
      at
      sun.awt.Win32GraphicsDevice.displayChanged(Win32GraphicsDevice.java:333)
      at
      sun.awt.Win32GraphicsEnvironment.displayChanged(Win32GraphicsEnvironment.java:90
      )
      at sun.awt.windows.WToolkit$4.run(WToolkit.java:717)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:443)
      at
      java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:1
      90)
      at
      java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144
      )
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /*
       * SimpleApplet
       * try to reproduce crash on display change
       *
       * created: mpichler, 20020620
       * changed: mpichler, 20020620
       *
       */

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class SimpleApplet extends JApplet implements ActionListener
      {
        // Applet.init
        public void init ()
        {
          Container contentpane = getContentPane (); // content pane of the root pane
          contentpane.setLayout (new BorderLayout ());

          contentpane.add (new JLabel ("hello JApplet!"), BorderLayout.CENTER);
          JButton button = new JButton ("alive?");
          button.addActionListener (this);
          contentpane.add (button, BorderLayout.SOUTH);

          try
          {
            if (getParameter ("changelaf") != null)
            {
              UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ());
              System.err.println ("installed system look and feel");
            }
          }
          catch (Exception elaf)
          {
            System.err.println ("Error loading L&F: " + elaf);
          }

          System.err.println ("java.version: " + System.getProperty ("java.version"));
        }

        // ActionListener
        public void actionPerformed (ActionEvent e)
        {
          // e.getSource == button
          System.err.println ("yes, I'm alive. it is " + System.currentTimeMillis ());
        }

      }
      --- cut here ---
      <HTML>
      <HEAD>
      <title>SimpleApplet</title>
      </HEAD>
      <BODY>
      <H1>SimpleApplet JRE 1.4</H1>

      <OBJECT classid="clsid:CAFEEFAC-0014-0000-0000-ABCDEFFEDCBA"
        width="300" height="200"
        
      codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_0-win.cab#Vers
      ion=1,4,0,0">
        <param name="code" value="SimpleApplet">
        <!-- param name="archive" value="archive.jar" -->
        <param name="MAYSCRIPT" value="true">
        <param name="XXchangelaf" value="true">
        <param name="type" value="application/x-java-applet;jpi-version=1.4">
        <COMMENT>
        <!-- EMBED tag for netscape goes here -->
        </COMMENT><b>Error: Java Plugin not actived in your browser.</b>
        <!--/NOEMBED--></EMBED>
      </OBJECT>

      </BODY>
      </HTML>

      ---------- END SOURCE ----------
      (Review ID: 153902)
      ======================================================================

            art Artem Ananiev (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: