private void addAction(final String title, final Action action) { actionListBox.addAction( title, new Action() { @Override public void doAction() { if (closeBeforeAction) { close(); } action.doAction(); if (!closeBeforeAction) { close(); } } }); actionListBox.setPreferredSize( new TerminalSize( actionListBox.getPreferredSize().getColumns(), actionListBox.getPreferredSize().getRows() + 1)); }
/** * Adds an action to the list, using toString() of the action as a label * * @param action Action to be performed when the user presses enter key */ public void addAction(final Action action) { addAction(action.toString(), action); }