class ActionListBox extends AbstractListBox<Runnable, ActionListBox> {

    /**
     * Default constructor, creates an {@code ActionListBox} with no pre-defined size that will request to be big enough
     * to display all items
     */
    public ActionListBox() {
        this(null);
    }

    /**
     * Creates a new {@code ActionListBox} with a pre-set size. If the items don't fit in within this size, scrollbars
     * will be used to accommodate. Calling {@code new ActionListBox(null)} has the same effect as calling
     * {@code new ActionListBox()}.
     * @param preferredSize Preferred size of this {@link ActionListBox}
     */
    public ActionListBox(TerminalSize preferredSize) {
        super(preferredSize);
    }

    /**
     * {@inheritDoc}
     *
     * The label of the item in the list box will be the result of calling {@code .toString()} on the runnable, which
     * might not be what you want to have unless you explicitly declare it. Consider using
     * {@code addItem(String label, Runnable action} instead, if you want to just set the label easily without having
     * to override {@code .toString()}.
     *
     * @param object Runnable to execute when the action was selected and fired in the list
     * @return Itself
     */
    @Override
    public ActionListBox addItem(Runnable object) {
        return super.addItem(object);
    }

    /**
     * Adds a new item to the list, which is displayed in the list using a supplied label.
     * @param label Label to use in the list for the new item
     * @param action Runnable to invoke when this action is selected and then triggered
     * @return Itself
     */
    public ActionListBox addItem(final String label, final Runnable action) {
        return addItem(new Runnable() {
            @Override
            public void run() {
                action.run();
            }

            @Override
            public String toString() {
                return label;
            }
        });
    }

    @Override
    public TerminalPosition getCursorLocation() {
        return null;
    }

    @Override
    public Result handleKeyStroke(KeyStroke keyStroke) {<FILL_FUNCTION_BODY>}
    
    public void runSelectedItem() {
        Object selectedItem = getSelectedItem();
        if (selectedItem != null) {
            ((Runnable) selectedItem).run();
        }
    }
	
}

        if (isKeyboardActivationStroke(keyStroke)) {
            runSelectedItem();
            return Result.HANDLED;
        } else if (keyStroke.getKeyType() == KeyType.MOUSE_EVENT) {
            MouseAction mouseAction = (MouseAction) keyStroke;
            MouseActionType actionType = mouseAction.getActionType();
            
            if (isMouseMove(keyStroke)
                    || actionType == MouseActionType.CLICK_RELEASE
                    || actionType == MouseActionType.SCROLL_UP
                    || actionType == MouseActionType.SCROLL_DOWN) {
                return super.handleKeyStroke(keyStroke);
            }
            
            // includes mouse drag
            int existingIndex = getSelectedIndex();
            int newIndex = getIndexByMouseAction(mouseAction);
            if (existingIndex != newIndex || !isFocused() || actionType == MouseActionType.CLICK_DOWN) {
                // the index has changed, or the focus needs to be obtained, or the user is clicking on the current selection to perform the action again
                Result result = super.handleKeyStroke(keyStroke);
                runSelectedItem();
                return result;
            }
            return Result.HANDLED;
        } else {
            Result result = super.handleKeyStroke(keyStroke);
            //runSelectedItem();
            return result;
        }
    
<methods>public synchronized com.googlecode.lanterna.gui2.ActionListBox addItem(java.lang.Runnable) ,public synchronized com.googlecode.lanterna.gui2.ActionListBox clearItems() ,public synchronized java.lang.Runnable getItemAt(int) ,public synchronized int getItemCount() ,public synchronized List<java.lang.Runnable> getItems() ,public int getSelectedIndex() ,public synchronized java.lang.Runnable getSelectedItem() ,public synchronized com.googlecode.lanterna.gui2.Interactable.Result handleKeyStroke(com.googlecode.lanterna.input.KeyStroke) ,public synchronized int indexOf(java.lang.Runnable) ,public synchronized boolean isEmpty() ,public boolean isFocusable() ,public synchronized java.lang.Runnable removeItem(int) ,public synchronized com.googlecode.lanterna.gui2.ActionListBox setListItemRenderer(ListItemRenderer<java.lang.Runnable,com.googlecode.lanterna.gui2.ActionListBox>) ,public synchronized com.googlecode.lanterna.gui2.ActionListBox setSelectedIndex(int) <variables>private final non-sealed List<java.lang.Runnable> items,private ListItemRenderer<java.lang.Runnable,com.googlecode.lanterna.gui2.ActionListBox> listItemRenderer,protected com.googlecode.lanterna.TerminalPosition scrollOffset,private int selectedIndex