void (MenuDragMouseEvent e) { MenuSelectionManager manager=e.getMenuSelectionManager(); Point p=e.getPoint(); if(p.x>=0&&p.x<menuItem.getWidth()&& p.y>=0&&p.y<menuItem.getHeight()){ doClick(manager,e); } else{ manager.clearSelectedPath(); } }