Class ListSelectDialog<T>
java.lang.Object
com.googlecode.lanterna.gui2.AbstractBasePane<Window>
com.googlecode.lanterna.gui2.AbstractWindow
com.googlecode.lanterna.gui2.dialogs.DialogWindow
com.googlecode.lanterna.gui2.dialogs.ListSelectDialog<T>
- Type Parameters:
T- Type of elements in the list
Dialog that allows the user to select an item from a list
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractBasePane
AbstractBasePane.ContentHolderNested classes/interfaces inherited from interface Window
Window.Hint -
Field Summary
FieldsFields inherited from class AbstractBasePane
contentHolder, interactableLookupMap -
Constructor Summary
ConstructorsConstructorDescriptionListSelectDialog(String title, String description, TerminalSize listBoxPreferredSize, boolean canCancel, List<T> content) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidonCancel()private voidshowDialog(WindowBasedTextGUI textGUI) Opens the dialog by showing it on the GUI and doesn't return until the dialog has been closedstatic <T> TshowDialog(WindowBasedTextGUI textGUI, String title, String description, int listBoxHeight, T... items) Shortcut for quickly creating a new dialogstatic <T> TshowDialog(WindowBasedTextGUI textGUI, String title, String description, TerminalSize listBoxSize, T... items) Shortcut for quickly creating a new dialogstatic <T> TshowDialog(WindowBasedTextGUI textGUI, String title, String description, T... items) Shortcut for quickly creating a new dialogMethods inherited from class AbstractWindow
addWindowListener, close, draw, fromGlobal, fromGlobalToContentRelative, fromGlobalToDecoratedRelative, getDecoratedSize, getHints, getPosition, getPostRenderer, getPreferredSize, getSize, getTextGUI, getTitle, handleInput, isVisible, removeWindowListener, setCloseWindowWithEscape, setContentOffset, setDecoratedSize, setFixedSize, setHints, setPosition, setSize, setTextGUI, setTitle, setVisible, setWindowPostRenderer, toGlobal, toGlobalFromContentRelative, toGlobalFromDecoratedRelative, waitUntilClosedMethods inherited from class AbstractBasePane
addBasePaneListener, getBasePaneListeners, getComponent, getCursorPosition, getFocusedInteractable, getMenuBar, getTheme, invalidate, isInvalid, removeBasePaneListener, setComponent, setEnableDirectionBasedMovements, setFocusedInteractable, setFocusedInteractable, setMenuBar, setStrictFocusChange, setThemeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BasePane
getTheme, setEnableDirectionBasedMovements, setStrictFocusChange, setThemeMethods inherited from interface Window
getBounds, getComponent, getCursorPosition, getFocusedInteractable, getMenuBar, invalidate, isInvalid, setComponent, setFocusedInteractable, setMenuBar
-
Field Details
-
result
-
-
Constructor Details
-
ListSelectDialog
ListSelectDialog(String title, String description, TerminalSize listBoxPreferredSize, boolean canCancel, List<T> content)
-
-
Method Details
-
onSelect
-
onCancel
private void onCancel() -
showDialog
Opens the dialog by showing it on the GUI and doesn't return until the dialog has been closed- Overrides:
showDialogin classDialogWindow- Parameters:
textGUI- Text GUI to add the dialog to- Returns:
- The item in the list that was selected or
nullif the dialog was cancelled
-
showDialog
@SafeVarargs public static <T> T showDialog(WindowBasedTextGUI textGUI, String title, String description, T... items) Shortcut for quickly creating a new dialog- Type Parameters:
T- Type of items in the dialog- Parameters:
textGUI- Text GUI to add the dialog totitle- Title of the dialogdescription- Description of the dialogitems- Items in the dialog- Returns:
- The selected item or
nullif cancelled
-
showDialog
@SafeVarargs public static <T> T showDialog(WindowBasedTextGUI textGUI, String title, String description, int listBoxHeight, T... items) Shortcut for quickly creating a new dialog- Type Parameters:
T- Type of items in the dialog- Parameters:
textGUI- Text GUI to add the dialog totitle- Title of the dialogdescription- Description of the dialoglistBoxHeight- Maximum height of the list box, scrollbars will be used if there are more itemsitems- Items in the dialog- Returns:
- The selected item or
nullif cancelled
-
showDialog
@SafeVarargs public static <T> T showDialog(WindowBasedTextGUI textGUI, String title, String description, TerminalSize listBoxSize, T... items) Shortcut for quickly creating a new dialog- Type Parameters:
T- Type of items in the dialog- Parameters:
textGUI- Text GUI to add the dialog totitle- Title of the dialogdescription- Description of the dialoglistBoxSize- Maximum size of the list box, scrollbars will be used if the items cannot fititems- Items in the dialog- Returns:
- The selected item or
nullif cancelled
-