예제 #1
0
  public void show(Event e) {
    Component origin = (Component) e.target;
    WComponentPeer peer = (WComponentPeer) WToolkit.targetToPeer(origin);
    if (peer == null) {
      // A failure to map the peer should only happen for a
      // lightweight component, then find the actual native parent from
      // that component.  The event coorinates are going to have to be
      // remapped as well.
      Component nativeOrigin = WToolkit.getNativeContainer(origin);
      e.target = nativeOrigin;

      // remove the event coordinates
      for (Component c = origin; c != nativeOrigin; c = c.getParent()) {
        Point p = c.getLocation();
        e.x += p.x;
        e.y += p.y;
      }
    }
    _show(e);
  }