AddRemoveTest Example

This example is a simplified version of the AddRemoveTest example found in the EAI Spec A local modified copy of the original is in theAddRemoveTest directory.

This README file is NOT a tutorial, we just outline a few interesting bits of code: Getting a handle on a DEFed object in the scene. In this cas a Group (could be Transform) Node called ROOT (see the file root.wrl)

  // Get root node of the scene, and its EventIns
  root = browser.getNode("ROOT");
Once we got the handle we can get a handle to the field EventIn "addchildren" and to the field EventOut "removechildren"
   addChildren = (EventInMFNode) root.getEventIn("addChildren");
   removeChildren = (EventInMFNode) root.getEventIn("removeChildren");
This inserts 2 Java buttons into the applet:
    add(addButton = new Button("Add Sphere"));
    add(removeButton = new Button("Remove Sphere"));
The Java method below will catch user events (e.g. user clickin on the Add Sphere Button) and then call the xxx.setValue methods. xxx is a handle for the Event fields (see above) and .setValue will set a value (in this case pass a node reference to be added or removed).
  public boolean action(Event event, Object what) {
    // Catch all Events from type Button
    if ( instanceof Button) {
      Button b = (Button);
      // either addButton or removeButton has been clicked on
      if (b == addButton) {
      else if (b == removeButton) {
    return true;