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

ClassCastException error in JDK 1.2 - JFC

XMLWordPrintable

    • generic
    • solaris_2.6


      tushar.patel@West 1998-12-15
      Here is a problem in JDK 1.2 latest revision.

      The code:

      class HelpMI extends MyMenuItem {
      private JFrame mainFrame;
      private HelpDialog helpDialog;

      public HelpMI(String name, JFrame mainFrame, Font font) {
      super(name, font);
      this.mainFrame = mainFrame;
      addActionListener( new HelpML());
      }
       
      class HelpML implements ActionListener
      {
      public void actionPerformed(ActionEvent e)
      {
      helpDialog = new HelpDialog(mainFrame);
      }
      }
      }

      public class HelpDialog {
      // Constants
      private static final String TITLE = "Help";

      public HelpDialog(JFrame parent) {
      JOptionPane.showMessageDialog(parent, "Help is not implemented.",
      TITLE, JOptionPane.PLAIN_MESSAGE);
      }
      }


      causes the exception:

      java.lang.ClassCastException: java.awt.AWTEventMulticaster
              at
      java.awt.Toolkit$ToolkitEventMulticaster.remove(Toolkit.java:1159)
              at java.awt.Toolkit.removeAWTEventListener(Toolkit.java:1122)
              at java.awt.LightweightDispatcher$2.run(Container.java:1847)
              at java.security.AccessController.doPrivileged(Compiled Code)
              at
      java.awt.LightweightDispatcher.stopListeningForOtherDrags(Compiled Code)
              at java.awt.LightweightDispatcher.trackMouseEnterExit(Compiled
      Code)
              at java.awt.LightweightDispatcher.processMouseEvent(Compiled
      Code)
              at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
              at java.awt.Container.dispatchEventImpl(Compiled Code)
              at java.awt.Window.dispatchEventImpl(Compiled Code)
              at java.awt.Component.dispatchEvent(Compiled Code)
              at java.awt.EventQueue.dispatchEvent(Compiled Code)
              at java.awt.EventDispatchThread.run(Compiled Code)


      When the mouse is moved off the main parent frame, after the dialog was
      created
      a second time, the Exception occurs.

      SunOS javamind 5.6 Generic_105181-05 sun4u sparc SUNW,Ultra-1-Engine
      java full version "Solaris_JDK_1.2_01_dev05_fcsK"

            feckssunw Fred Ecks (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: