I am working on a small test program. I have three ColorCubes in my scene, all attached to different switches (see attached for the scenegraph). I am rendering only the first of these cubes by the switch statements.
I want to wakeup the other two cubes three seconds after I press the button on the GUI. I created a time behaviour class which uses WakeupOnElapsedTime(3000). But the problem is that the cubes are woke up three seconds after the scene is constructed. How can I link my behaviour with the JButton event so that the cubes are woke up when I press the button?
Thanks
public void initialize()
{
System.out.println("INITIALIZED");
critter = new WakeupOnElapsedTime(3000);
resetEvents();
}
protected final void resetEvents()
{
wakeupOn(critter);
}
// protected abstract void processAWTEvent(AWTEvent evt);
public void processStimulus(Enumeration criteria)
{
System.out.println("RUNNING PROCESS STIMULUS");
WakeupCondition cond;
while(criteria.hasMoreElements())
{
cond = (WakeupCondition)criteria.nextElement();
if(cond instanceof WakeupOnElapsedTime)
{
System.out.println("WAKE UP");
Switch1.setWhichChild(Switch.CHILD_NONE);
Switch2.setWhichChild(Switch.CHILD_ALL);
Switch3.setWhichChild(Switch.CHILD_ALL);
}
}
}
<<inline: sw.JPG>>
<<inline: UI.jpg>>