Package adams.terminal.dialog
Class OptionDialog
- java.lang.Object
-
- com.googlecode.lanterna.gui2.AbstractBasePane<com.googlecode.lanterna.gui2.Window>
-
- com.googlecode.lanterna.gui2.AbstractWindow
-
- com.googlecode.lanterna.gui2.dialogs.DialogWindow
-
- adams.terminal.dialog.OptionDialog
-
- All Implemented Interfaces:
com.googlecode.lanterna.gui2.BasePane
,com.googlecode.lanterna.gui2.Composite
,com.googlecode.lanterna.gui2.Window
public class OptionDialog extends com.googlecode.lanterna.gui2.dialogs.DialogWindow
Dialog for displaying a combobox with options.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description OptionDialog(String title, String description, String[] options, String initial)
Default constructor, takes a title for the dialog and runs code shared for dialogsOptionDialog(String title, String description, String[] options, String initial, Collection<com.googlecode.lanterna.gui2.Window.Hint> hints)
Default constructor, takes a title for the dialog and runs code shared for dialogs
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
onCancel()
protected void
onOK()
String
showDialog(com.googlecode.lanterna.gui2.WindowBasedTextGUI textGUI)
static String
showDialog(com.googlecode.lanterna.gui2.WindowBasedTextGUI textGUI, String title, String description, String[] options, String initial)
Shortcut for quickly showing aOptionDialog
.static String
showDialog(com.googlecode.lanterna.gui2.WindowBasedTextGUI textGUI, String title, String description, String[] options, String initial, Collection<com.googlecode.lanterna.gui2.Window.Hint> hints)
Shortcut for quickly showing aOptionDialog
.-
Methods inherited from class com.googlecode.lanterna.gui2.AbstractWindow
addWindowListener, close, draw, fromGlobal, getDecoratedSize, getHints, getPosition, getPostRenderer, getPreferredSize, getSize, getTextGUI, getTitle, handleInput, isVisible, removeWindowListener, setCloseWindowWithEscape, setContentOffset, setDecoratedSize, setHints, setPosition, setSize, setTextGUI, setTitle, setVisible, setWindowPostRenderer, toGlobal, waitUntilClosed
-
Methods inherited from class com.googlecode.lanterna.gui2.AbstractBasePane
addBasePaneListener, getBasePaneListeners, getComponent, getCursorPosition, getFocusedInteractable, getTheme, invalidate, isInvalid, removeBasePaneListener, setComponent, setEnableDirectionBasedMovements, setFocusedInteractable, setFocusedInteractable, setStrictFocusChange, setTheme
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
OptionDialog
public OptionDialog(String title, String description, String[] options, String initial)
Default constructor, takes a title for the dialog and runs code shared for dialogs- Parameters:
title
- Title of the windowdescription
- the description to displayoptions
- the options to display in a comboboxinitial
- the initial value
-
OptionDialog
public OptionDialog(String title, String description, String[] options, String initial, Collection<com.googlecode.lanterna.gui2.Window.Hint> hints)
Default constructor, takes a title for the dialog and runs code shared for dialogs- Parameters:
title
- Title of the windowdescription
- the description to displayoptions
- the options to display in a comboboxinitial
- the initial valuehints
- the window hints
-
-
Method Detail
-
onOK
protected void onOK()
-
onCancel
protected void onCancel()
-
showDialog
public String showDialog(com.googlecode.lanterna.gui2.WindowBasedTextGUI textGUI)
- Overrides:
showDialog
in classcom.googlecode.lanterna.gui2.dialogs.DialogWindow
-
showDialog
public static String showDialog(com.googlecode.lanterna.gui2.WindowBasedTextGUI textGUI, String title, String description, String[] options, String initial)
Shortcut for quickly showing aOptionDialog
.- Parameters:
textGUI
- GUI to show the dialog ontitle
- Title of the dialogdescription
- Description of the dialoginitial
- the initial selection- Returns:
- The option the user selected, or
null
if the dialog was cancelled
-
showDialog
public static String showDialog(com.googlecode.lanterna.gui2.WindowBasedTextGUI textGUI, String title, String description, String[] options, String initial, Collection<com.googlecode.lanterna.gui2.Window.Hint> hints)
Shortcut for quickly showing aOptionDialog
.- Parameters:
textGUI
- GUI to show the dialog ontitle
- Title of the dialogdescription
- Description of the dialoginitial
- the initial selectionhints
- the window hints- Returns:
- The option the user selected, or
null
if the dialog was cancelled
-
-