addInputEventListener(new PBasicInputEventHandler() { public void mouseClicked(PInputEvent e) { PPickPath pickPath = e.getPath(); PNode node; while((node = pickPath.getPickedNode()) != null && !e.isHandled()) { if(node instanceof MouseDownSensitive) { ((MouseDownSensitive)node).respondMouseClick(e); e.setHandled(true); } else { pickPath.popNode(node); } } }  public void mouseMoved(PInputEvent e) { PPickPath pickPath = e.getPath(); PNode node; while((node = pickPath.getPickedNode()) != null && !e.isHandled()) { if(node instanceof MouseOverSensitive) { ((MouseOverSensitive)node).respondMouseEnter(e); e.setHandled(true); } else { pickPath.popNode(node); } } } });  addInputEventListener(new PDragSequenceEventHandler() {   public void startDrag(PInputEvent e) {  setIsDragging(true); }  public void drag(PInputEvent e) { PPickPath pickPath = e.getPath(); PNode node; while((node = pickPath.getPickedNode()) != null && !e.isHandled()) { if(node instanceof MouseDragSensitive) { ((MouseDragSensitive)node).respondDrag(e); e.setHandled(true); } else { pickPath.popNode(node); } } }  public void endDrag(PInputEvent e) { PPickPath pickPath = e.getPath(); PNode node; while((node = pickPath.getPickedNode()) != null && !e.isHandled()) { if(node instanceof MouseDragSensitive) { ((MouseDragSensitive)node).respondEndDrag(e); e.setHandled(true); } } } });
addInputEventListener(BrowserViewEventDispatcher.getDefaultMouseHandler()); addInputEventListener(BrowserViewEventDispatcher.getDefaultDragHandler());
    private void init(BrowserTopModel topModel)    {        env = BrowserEnvironment.getInstance();                setBackground(new Color(192,192,192));        backgroundNode = new BackgroundNode();        getLayer().addChild(backgroundNode);                layoutMap = new HashMap();        footprint = new Rectangle2D.Double(0,0,0,0);        hoverSensitive = new HashSet();        regionSensitive = new HashSet();                removeInputEventListener(getZoomEventHandler());        removeInputEventListener(getPanEventHandler());               // default panning mode (may replace this, but probably not)        overlayCamera = new BrowserCamera(topModel,getCamera());        hoverSensitive.add(overlayCamera);        regionSensitive.add(overlayCamera);        scaleToShow = true;               addMouseListener(new MouseAdapter()        {            public void mouseEntered(MouseEvent me)            {                for(Iterator iter = hoverSensitive.iterator(); iter.hasNext();)                {                     HoverSensitive hover = (HoverSensitive)iter.next();                     hover.contextEntered();                }            }                        public void mouseExited(MouseEvent me)            {                for(Iterator iter = hoverSensitive.iterator(); iter.hasNext();)                {                     HoverSensitive hover = (HoverSensitive)iter.next();                     hover.contextExited();                }            }        });                // OK, now, dispatch to the underlying nodes        addInputEventListener(new PBasicInputEventHandler()        {            public void mouseClicked(PInputEvent e)            {                PPickPath pickPath = e.getPath();                PNode node;                while((node = pickPath.getPickedNode()) != null &&                      !e.isHandled())                {                    if(node instanceof MouseDownSensitive)                    {                        ((MouseDownSensitive)node).respondMouseClick(e);                        e.setHandled(true);                    }                    else                    {                        pickPath.popNode(node);                    }                }            }                        public void mouseMoved(PInputEvent e)            {                PPickPath pickPath = e.getPath();                PNode node;                while((node = pickPath.getPickedNode()) != null &&                    !e.isHandled())                {                    if(node instanceof MouseOverSensitive)                    {                        ((MouseOverSensitive)node).respondMouseEnter(e);                        e.setHandled(true);                    }                    else                    {                        pickPath.popNode(node);                    }                }            }        });                addInputEventListener(new PDragSequenceEventHandler()        {            // OK, rant: this is stupid that this isn't the default behavior.            // Jesse Grosjean, fix this thing, man, come on man.            public void startDrag(PInputEvent e)            {                                setIsDragging(true);            }                        public void drag(PInputEvent e)            {                PPickPath pickPath = e.getPath();                PNode node;                while((node = pickPath.getPickedNode()) != null &&                      !e.isHandled())                {                    if(node instanceof MouseDragSensitive)                    {                        ((MouseDragSensitive)node).respondDrag(e);                        e.setHandled(true);                    }                    else                    {                        pickPath.popNode(node);                    }                }            }                        public void endDrag(PInputEvent e)            {                PPickPath pickPath = e.getPath();                PNode node;                while((node = pickPath.getPickedNode()) != null &&                      !e.isHandled())                {                    if(node instanceof MouseDragSensitive)                    {                        ((MouseDragSensitive)node).respondEndDrag(e);                        e.setHandled(true);                    }                }            }        });    }