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

NullPointerException when dismissing internal message dialog

XMLWordPrintable



      Name: skT88420 Date: 01/05/2000


      C:\Java\Src\ui>java -version
      java version "1.2.2"
      Classic VM (build JDK-1.2.2-001, native threads, symcjit)

      C:\Java\Src\ui>


      The following applet will cause a NullPointerException when dismissing
      the internal message dialog. To verify, run applet, press button to show
      message dialog, press OK on internal message dialog. The error does not
      occur if the call to showInternalMessageDialog is replaced with a call
      to showMessageDialog.



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

      public class msg_test extends JApplet
      {
          public void init()
          {
              JButton showMsgButton = new JButton("Show Message");
              showMsgButton.setDefaultCapable(true);
              showMsgButton.addActionListener(new ShowMsgListener());
              
              getRootPane().setDefaultButton(showMsgButton);
              getContentPane().add(showMsgButton, BorderLayout.SOUTH);
          }
          
          class ShowMsgListener implements ActionListener
          {
           public void actionPerformed(ActionEvent e)
              {
                  JOptionPane.showInternalMessageDialog(getContentPane(), "Press OK to test message dialog!");
              }
          }
      }


      The above can be tested with the following HTML code:

      <HTML>

      <APPLET code="msg_test.class" width=400 height=300>
      </APPLET>

      </HTML>
      (Review ID: 99620)
      ======================================================================

            amfowler Anne Fowler (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: