void () { Component c = focusManager.getFocusOwner(); if (ComponentUtil.isMeaninglessFocusOwner(c)) { // this allows using popup menus and menu bar without stopping cell editing return; } while (c != null) { if (c instanceof JPopupMenu) { c = ((JPopupMenu)c).getInvoker(); } if (c == JBTable.this) { // focus remains inside the table return; } else if (c instanceof Window) { if (c == SwingUtilities.getWindowAncestor(JBTable.this)) { removeCellEditor(); } break; } c = c.getParent(); } }