calling addMouseListener in jscript throws ClassCastException

From: Jon-Paul Dobson (jon-paul.dobson_at_aircom.co.uk)
Date: 09/15/04


Date: 15 Sep 2004 03:58:47 -0700

Hi,

We have an applet that implements the MouseListener interface but when
trying to add the applet to the glasspane of another applet a
classcastexception is thrown.

This all seemed to work fine when using JDK1.3.1_08 but since using
JDK1.4.2 it does not work.

The class implementing the mouse listener interface is defined using:

public class MapListener extends JApplet implements MouseListener,
MouseMotionListener

and created within the HTML page using:

<applet width="600" height="0" code="MapListener.class"
name="MapListener" MAYSCRIPT="true"> </applet>

The MapListener object is referenced in jscript using:

var applet = parent.mapFrame.document.MapListener;

and is added to the glass pane of an applet named IMSMap using:

parent.mapFrame.IMSMap.getGlassPane().addMouseListener(applet);

This line however throws a jscript exception with message
'java.lang.ClassCastException: javax.swing.JPanel' and with name
'RangeError'

We are using IE6.0.2800

Any light anybody could shed on this would be very greatfully
received.

Thanks,

Jon-Paul.