@Override
    public void processMouse(int mouseX, int mouseY, Set<Integer> buttons) {
        if (!isVisible()) return;

        int i = 0;
        hoverIndex = -1;
        for (Item item : items) {
            if (item.bounds != null && item.bounds.contains(mouseX, mouseY) && item.isSelectable())
                currentItem = hoverIndex = i;
            i++;
        }

        if (buttons.contains(MouseEvent.BUTTON1)) {
            clickIndex = hoverIndex;
        }
        else if (clickIndex != -1 && hoverIndex == clickIndex) {
            if (items.get(clickIndex).isSelectable()) {
                lastItem = clickIndex;
                items.get(clickIndex).action.doAction(this);
            }
            clickIndex = -1;
        }
        else clickIndex = -1;
    }