Java Reference
In-Depth Information
Figure 29. Code segment for MouseBehaviorUserDefine.java
1.
public void initialize()
2.
{
3.
//set initial wakeup condition
4.
events[0]=new WakeupOnAWTEvent(MouseEvent.MOUSE_DRAGGED);
5.
events[1]=new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED);
6.
events[2]=new WakeupOnAWTEvent(MouseEvent.MOUSE_RELEASED);
7.
events[3]=new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED);
8.
allEvents=new WakeupOr(events);
9.
wakeupOn(allEvents);
10. }
two of which create a WakeupCondition from several WakeupCriterion through a logical
And and Or operation. Similarly, the last two constructors allow for the composition of the
first two classes into more complex WakeupCondition objects.
The code fragment in Figure 29 illustrates the use of WakeupOr to construct a behavior
trigger for capturing any of the event mouse conditions stated.
summary
In this chapter, we have discussed how behavior class can be used to detect user inputs and
changes in the graphical objects for the purpose of allowing the user to interact with a Java
3D created virtual world (Wang, Wong, Shen, & Lang, 2001). Specifically, through the
construction of custom wakeup conditions and criteria, the system will be able to provide
changes to the virtual 3D scene and objects through some appropriate processStimulus
methods when the relevant stimulus or trigger condition is received. Complicated behavior
can be handled by creating specialized wakeup triggers that respond to combinations of
wakeup conditions, by having behaviors that post events, by detecting object collisions as
well as the entry and exit of objects and viewing platforms into certain spatial bounds.
references
Geroimenko, V., & Geroimenko, L. (2000). Visualizing human consciousness content using
Java 3D/X3D and psychological techniques. Proceedings IEEE Conference on Information
Visualization (pp. 529-532).
Search WWH ::




Custom Search