Thanks a lot! It works. But I found something interesting. Could someone
explain about it?

My code is copied as below. At each click, there are two events passed the
if statement at line6. one is " Button Pressed and Released" pair event,
the other is "Button Clicked" event, The pick behavior was activated twice.
However, only one pickResult has non-null result ( the other pickResult is
null).

Thanks in advance!




1. public void processStimulus(Enumeration criteria)
    {
                ...... ......
2.      while (criteria.hasMoreElements()) {
                ......
3.              event = ((WakeupOnAWTEvent)wakeup).getAWTEvent();
4.              for (int i=0; i<event.length; i++) {
5.                      id = event[i].getID();
6.                      if ((id == MouseEvent.MOUSE_CLICKED) &
((MouseEvent)event[i]).isShiftDown() ) {
                                int xpos = ((MouseEvent)event[i]).getX();
                                int ypos = ((MouseEvent)event[i]).getY();
                                pCanvas.setShapeLocation(xpos,ypos);
                                pickResult = pCanvas.pickAny();

                                if (pickResult != null) {
                                        Link lk = (Link) 
pickResult.getNode(PickResult.LINK);
                                        System.out.println(lk.getUserData());
                                }
                                else
                                        System.out.println("pickResult is null");
                        } // if shift clicked
                } // for i
        ......
        } // while
        wakeupOn(buttonPressed);
}
Lan Wu-Cavener
Research Associate and Programmer
Dept. of Landscape Architecture

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