void (MouseEvent event) { if (!event.isConsumed()) { Crumb crumb = null; BiConsumer<Crumb, InputEvent> consumer = null; switch (event.getID()) { case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_ENTERED: crumb = getCrumbAt(event.getX(), event.getY()); case MouseEvent.MOUSE_EXITED: if (!isHovered(crumb)) consumer = hover; break; case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: if (event.isPopupTrigger()) { crumb = getCrumbAt(event.getX(), event.getY()); if (crumb == null) break; // crumb is not found Collection<? extends Action> actions = crumb.getContextActions(); if (actions.isEmpty()) break; // nothing to show DefaultActionGroup group = new DefaultActionGroup(); for (Action action : actions) { if (action != null) { group.add(ActionUtil.createActionFromSwingAction(action)); } else { group.addSeparator(); } } JPopupMenu popup = ActionManager.getInstance().createActionPopupMenu("crumbs", group).getComponent(); Component invoker = event.getComponent(); popup.show(invoker, event.getX(), invoker.getHeight()); event.consume(); } else if (isLeftMouseButton(event)) { crumb = getCrumbAt(event.getX(), event.getY()); if (crumb != null) consumer = select; } break; } if (consumer != null) { consumer.accept(crumb, event); event.consume(); revalidate(); repaint(); } } }