This code may help:

class YourBehavior extends Behavior
{
   // Set up WakeupCriterion.
   WakeupCriterion criterion[] = {
   new WakeupOnElapsedFrames(0),
   new WakeupOnElapsedTime(5000),
   new WakeupOnAWTEvent(MouseEvent.MOUSE_DRAGGED)
   };

   WakeupCondition conditions = null;

   public YourBehavior()
   {
      conditions = new WakeupOr(criterion);
   }

   public void initialize()
   {
      wakeupOn(conditions);
   }

   public void processStimulus(Enumeration criteria)
   {
      WakeupCriterion wakeup;
      AWTEvent[] event;
      int id = 0;

      while( criteria.hasMoreElements() )
      {
      wakeup =
(WakeupCriterion)criteria.nextElement();
      if( wakeup instanceof WakeupOnElapsedFrames )
      {
      }
   // DO THIS FOR EACH WakeupCriterion
   }
   wakeupOn(conditions);
}

Hope this helps.

-Sri :)


--- Fred Klingener <[EMAIL PROTECTED]> wrote:
> At 01:11 AM 5/6/2002 +0900, bh ahn wrote:
> >hi all
> >
> >I have tried to make program using Behavior class.
> >
> >In this program, I used WakeupOnElapsedFrames to
> effect smoothing movement.
> >
> >But I try to process keyevent, that used
> WakeupOnAWTEvent to wakeup behavior.
> >
> >How to code using WakeupOnElapsedFrames and
> WakeupOnAWTEvent simutaneously.
> >
> >thanks
> >
>
> I think the 'standard' pattern for this is to write
> a class that extends
> Behavior and implements whatever Listener you need
> to respond to your
> event.  You set the alarm to wake up on either
> PostId or ElapsedFrames.  In
> your event response method (the one you need to
> supply to implement the
> Listener), your class posts an Id to itself, then in
> processStimulus(), you
> pick apart the wakeup (whether it's PostId or
> ElapsedFrame) and respond
> accordingly.
>
> At least this is the way I've settled on.  It puts
> everything in one place,
> and it seems to produce no surprises in the way J3D
> schedules its
> processing.  So far.
>
>
>
> --
> Fred Klingener
> www.BrockEng.com
>
>
===========================================================================
> 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".


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

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