コード例 #1
0
 public void eventDispatched(final AWTEvent event) {
   if (event.getID() == WindowEvent.WINDOW_ACTIVATED) {
     if (myCancelOnWindow
         && myPopup != null
         && !myPopup.isPopupWindow(((WindowEvent) event).getWindow())) {
       cancel();
     }
   } else if (event.getID() == MouseEvent.MOUSE_ENTERED) {
     if (withinPopup(event)) {
       myEverEntered = true;
     }
   } else if (event.getID() == MouseEvent.MOUSE_MOVED) {
     if (myCancelOnMouseOutCallback != null && myEverEntered && !withinPopup(event)) {
       if (myCancelOnMouseOutCallback.check((MouseEvent) event)) {
         cancel();
       }
     }
   }
 }
コード例 #2
0
    @Override
    protected void focusedComponentChanged(final Component component, final AWTEvent cause) {
      EditorWindow newWindow = null;

      if (component != null) {
        newWindow = findWindowWith(component);
      } else if (cause instanceof ContainerEvent
          && cause.getID() == ContainerEvent.COMPONENT_REMOVED) {
        // do not change current window in case of child removal as in JTable.removeEditor
        // otherwise Escape in a toolwindow will not focus editor with JTable content
        return;
      }

      setCurrentWindow(newWindow);
      setCurrentWindow(newWindow, false);
    }