Well, I have a work around but it won't help unless you call
Behavior.setEnable(). In other words, it won't help if you are
enabling/disabling the behavior by removing/adding it to the scenegraph or
by using a Switch or by setting the schedulingBounds, etc.

Here's the workaround:

On construction or initialization of the behavior:
    long cutOff = System.currentTimeMillis();

then override setEnable:
    public void setEnable( boolean b ){
        if( b ){
            cutOff = System.currentTimeMillis();
        }
        super.setEnable( b );
    }

and then when collecting events, weed out any whose time was before cutOff.
    if( event.getWhen() < cutOff ){
        //Don't use it
    }

Hope to hear from the Sun team on this issue.

Raffi

-----Original Message-----
From: Kasparian, Raffi J. [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 03, 2001 11:13 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Behavior processStimulus Bug


Attached is a program that demonstrates what I think is a bug with
Behavior.processStimulus( Enumeration criteria ). When the program disables
the behavior and then enables it, "criteria" includes events that occurred
when the behavior was disabled. Surely this is not the intended behavior.

To use the program, click on the Canvas3D. System.out prints the number of
MouseEvents "criteria" contains. (Should be "1"). Now click the "Toggle"
button. This will toggle the behaviors enabled state. Click a few times on
the screen. System.out prints nothing (because the behavior is disabled).
Now click the "Toggle" button again and click once on the screen. System.out
prints the total number of clicks that occurred when the behavior was
disabled plus the most recent click.

Has anyone else experienced this problem. Does anyone have a good
work-around?

Thanks,

Raffi

 <<BugTest.java>>

===========================================================================
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