To state the obvious, either:

1) The criteria.nextElement() doesn't return a WakeupOnAWTEvent (Unlikely)
2) The events returned arn't MouseEvents (quite possible)
3) Or the pick ray doesn't hit a "Cone" object (very possible)

In any of theses cases, just print out the class of the thing (using
.getClass()) to find out whats going on.

Kev

Brobbey,Isaac (neuron) wrote:

Dear all:

i am getting a class cast exception

Exception occurred during Behavior execution:
java.lang.ClassCastException
       at PickBehavia.processStimulus(Testhandler.java:2184)
       at
javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:172)
       at javax.media.j3d.J3dThread.run(J3dThread.java:250)

from my behavoir code below , any Ideas ?

public void processStimulus (Enumeration criteria)
       {
               SceneGraphPath sceneGraphPath=null;
               AWTEvent[] event =
((WakeupOnAWTEvent)criteria.nextElement()).getAWTEvent();
               for (int i=0; i<event.length; i++)
               {
                       int x = ((MouseEvent)event[i]).getX();
                       int y = ((MouseEvent)event[i]).getY();
                       System.out.println("x="+" "+x);
                       PickRay pickRay = generatePickRay(x,y);

                       sceneGraphPath = branchGroup.pickAny(pickRay);
                       Cone someCone = (Cone)sceneGraphPath.getObject();

                       float Ht=someCone.getHeight();
                       System.out.println("cone height="+" "+Ht);
               }
}


thanks,

Isaac

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
lis

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to