TextGUI, WindowBasedTextGUIpublic class MultiWindowTextGUI extends AbstractTextGUI implements WindowBasedTextGUI
TextGUI.Listener| Constructor | Description |
|---|---|
MultiWindowTextGUI(TextGUIThreadFactory guiThreadFactory,
Screen screen) |
Creates a new
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. |
MultiWindowTextGUI(TextGUIThreadFactory guiThreadFactory,
Screen screen,
WindowManager windowManager) |
Creates a new
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations and a custom WindowManager. |
MultiWindowTextGUI(TextGUIThreadFactory guiThreadFactory,
Screen screen,
WindowManager windowManager,
WindowPostRenderer postRenderer,
Component background) |
Creates a new
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. |
MultiWindowTextGUI(Screen screen) |
Creates a new
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. |
MultiWindowTextGUI(Screen screen,
WindowManager windowManager,
Component background) |
Creates a new
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. |
MultiWindowTextGUI(Screen screen,
WindowManager windowManager,
WindowPostRenderer postRenderer,
Component background) |
Creates a new
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. |
MultiWindowTextGUI(Screen screen,
TextColor backgroundColor) |
Deprecated.
It's preferred to use a custom background component if you want to customize the background color,
or change the theme
|
| Modifier and Type | Method | Description |
|---|---|---|
WindowBasedTextGUI |
addWindow(Window window) |
Adds a window to the TextGUI system, depending on the window manager this window may or may not be immediately
visible.
|
WindowBasedTextGUI |
addWindowAndWait(Window window) |
Adds a window to the TextGUI system, depending on the window manager this window may or may not be immediately
visible.
|
WindowBasedTextGUI |
cycleActiveWindow(boolean reverse) |
Switches the active window by cyclically shuffling the window list.
|
protected void |
drawGUI(TextGUIGraphics graphics) |
Draws the entire GUI using a
TextGUIGraphics object |
Window |
getActiveWindow() |
Returns the window which the TextGUI considers the active one at the time of the method call.
|
BasePane |
getBackgroundPane() |
Returns the container for the background, which works as a single large component that takes up the whole
terminal area and is always behind all windows.
|
TerminalPosition |
getCursorPosition() |
Top-level method for drilling in to the GUI and figuring out, in global coordinates, where to place the text
cursor on the screen at this time.
|
Interactable |
getFocusedInteractable() |
Returns the interactable component currently in focus
|
WindowManager |
getWindowManager() |
Returns the window manager that is currently controlling this TextGUI.
|
WindowPostRenderer |
getWindowPostRenderer() |
Returns the
WindowPostRenderer for this WindowBasedTextGUI |
Collection<Window> |
getWindows() |
Returns a list of all windows currently in the TextGUI.
|
boolean |
handleInput(KeyStroke keyStroke) |
This method should take the user input and feed it to the focused component for handling.
|
boolean |
isEOFWhenNoWindows() |
Returns whether the TextGUI should return EOF when you try to read input while there are no windows in the window
manager.
|
boolean |
isPendingUpdate() |
This method can be used to determine if any component has requested a redraw.
|
WindowBasedTextGUI |
moveToTop(Window window) |
Windows are internally stored as a stack and newer windows are added at the top of the stack.
|
protected KeyStroke |
readKeyStroke() |
Reads one key from the input queue, blocking or non-blocking depending on if blocking I/O has been enabled.
|
WindowBasedTextGUI |
removeWindow(Window window) |
Removes a window from the TextGUI.
|
MultiWindowTextGUI |
setActiveWindow(Window activeWindow) |
Selects a particular window to be considered 'active' and receive all input events
|
void |
setEOFWhenNoWindows(boolean eofWhenNoWindows) |
Sets whether the TextGUI should return EOF when you try to read input while there are no windows in the window
manager.
|
void |
setVirtualScreenEnabled(boolean virtualScreenEnabled) |
This method controls whether or not the virtual screen should be used.
|
void |
updateScreen() |
Updates the screen, to make any changes visible to the user.
|
void |
waitForWindowToClose(Window window) |
Waits for the specified window to be closed
|
addListener, fireUnhandledKeyStroke, getGUIThread, getScreen, getTheme, invalidate, isBlockingIO, pollInput, processInput, removeListener, setBlockingIO, setThemeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListener, getGUIThread, getScreen, getTheme, processInput, removeListener, setThemepublic MultiWindowTextGUI(Screen screen)
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. The screen will be automatically wrapped in a VirtualScreen in order to deal with GUIs
becoming too big to fit the terminal. The background area of the GUI will be solid blue.screen - Screen to use as the backend for drawing operationspublic MultiWindowTextGUI(TextGUIThreadFactory guiThreadFactory, Screen screen)
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. The screen will be automatically wrapped in a VirtualScreen in order to deal with GUIs
becoming too big to fit the terminal. The background area of the GUI will be solid blueguiThreadFactory - Factory implementation to use when creating the TextGUIThreadscreen - Screen to use as the backend for drawing operationspublic MultiWindowTextGUI(TextGUIThreadFactory guiThreadFactory, Screen screen, WindowManager windowManager)
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations and a custom WindowManager. The screen will be automatically wrapped in a
VirtualScreen in order to deal with GUIs becoming too big to fit the terminal. The background area of the
GUI will use the default GUIBackdrop component.guiThreadFactory - Factory implementation to use when creating the TextGUIThreadscreen - Screen to use as the backend for drawing operationswindowManager - Custom window manager to use@Deprecated public MultiWindowTextGUI(Screen screen, TextColor backgroundColor)
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. The screen will be automatically wrapped in a VirtualScreen in order to deal with GUIs
becoming too big to fit the terminal. The background area of the GUI is a solid color as decided by the
backgroundColor parameter.screen - Screen to use as the backend for drawing operationsbackgroundColor - Color to use for the GUI backgroundpublic MultiWindowTextGUI(Screen screen, WindowManager windowManager, Component background)
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. The screen will be automatically wrapped in a VirtualScreen in order to deal with GUIs
becoming too big to fit the terminal. The background area of the GUI is the component passed in as the
background parameter, forced to full size.screen - Screen to use as the backend for drawing operationswindowManager - Window manager implementation to usebackground - Component to use as the background of the GUI, behind all the windowspublic MultiWindowTextGUI(Screen screen, WindowManager windowManager, WindowPostRenderer postRenderer, Component background)
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. The screen will be automatically wrapped in a VirtualScreen in order to deal with GUIs
becoming too big to fit the terminal. The background area of the GUI is the component passed in as the
background parameter, forced to full size.screen - Screen to use as the backend for drawing operationswindowManager - Window manager implementation to usepostRenderer - WindowPostRenderer object to invoke after each window has been drawnbackground - Component to use as the background of the GUI, behind all the windowspublic MultiWindowTextGUI(TextGUIThreadFactory guiThreadFactory, Screen screen, WindowManager windowManager, WindowPostRenderer postRenderer, Component background)
MultiWindowTextGUI that uses the specified Screen as the backend for all drawing
operations. The screen will be automatically wrapped in a VirtualScreen in order to deal with GUIs
becoming too big to fit the terminal. The background area of the GUI is the component passed in as the
background parameter, forced to full size.guiThreadFactory - Factory implementation to use when creating the TextGUIThreadscreen - Screen to use as the backend for drawing operationswindowManager - Window manager implementation to usepostRenderer - WindowPostRenderer object to invoke after each window has been drawnbackground - Component to use as the background of the GUI, behind all the windowspublic boolean isPendingUpdate()
TextGUItrue, you may want to call updateScreen().isPendingUpdate in interface TextGUIisPendingUpdate in class AbstractTextGUItrue if this TextGUI has a change and is waiting for someone to call updateScreen()public void updateScreen()
throws IOException
TextGUIupdateScreen in interface TextGUIupdateScreen in class AbstractTextGUIIOException - In case there was an underlying I/O errorprotected KeyStroke readKeyStroke() throws IOException
AbstractTextGUIsetBlockingIO(true).readKeyStroke in class AbstractTextGUIKeyStroke or null if blocking I/O is disabled and there was
no input waitingIOException - In case of an I/O error while reading inputprotected void drawGUI(TextGUIGraphics graphics)
AbstractTextGUITextGUIGraphics objectdrawGUI in class AbstractTextGUIgraphics - Graphics object to draw usingpublic TerminalPosition getCursorPosition()
AbstractTextGUIgetCursorPosition in class AbstractTextGUInull if the cursor should be hiddenpublic void setEOFWhenNoWindows(boolean eofWhenNoWindows)
eofWhenNoWindows - Should the GUI return EOF when there are no windows leftpublic boolean isEOFWhenNoWindows()
public void setVirtualScreenEnabled(boolean virtualScreenEnabled)
false, the virtual screen will be bypassed and any content outside of the screen will be cropped. This
property is true by default.setVirtualScreenEnabled in interface TextGUIvirtualScreenEnabled - If true, then virtual screen will be used, otherwise it is bypassedpublic Interactable getFocusedInteractable()
TextGUIgetFocusedInteractable in interface TextGUIpublic boolean handleInput(KeyStroke keyStroke)
AbstractTextGUIhandleInput in class AbstractTextGUIkeyStroke - KeyStroke representing the user inputtrue if the input was recognized and handled by the GUI, indicating that the GUI should be redrawnpublic WindowManager getWindowManager()
WindowBasedTextGUIgetWindowManager in interface WindowBasedTextGUIpublic WindowBasedTextGUI addWindow(Window window)
WindowBasedTextGUIaddWindowAndWait(..).
Windows are internally stored as a stack and newer windows are added at the top of the stack. The GUI system will
render windows in a predictable order from bottom to top. You can modify the stack by using
moveToTop(..) to move a Window from its current position in the stack to the top.addWindow in interface WindowBasedTextGUIwindow - Window to add to the GUIpublic WindowBasedTextGUI addWindowAndWait(Window window)
WindowBasedTextGUIaddWindow(..). This method call is useful for modal dialogs that requires a certain user input
before the application can continue.
Windows are internally stored as a stack and newer windows are added at the top of the stack. The GUI system will
render windows in a predictable order from bottom to top. You can modify the stack by using
moveToTop(..) to move a Window from its current position in the stack to the top.addWindowAndWait in interface WindowBasedTextGUIwindow - Window to add to the GUIpublic WindowBasedTextGUI removeWindow(Window window)
WindowBasedTextGUIremoveWindow in interface WindowBasedTextGUIwindow - Window to closepublic void waitForWindowToClose(Window window)
WindowBasedTextGUIwaitForWindowToClose in interface WindowBasedTextGUIwindow - Window to wait forpublic Collection<Window> getWindows()
WindowBasedTextGUIgetWindows in interface WindowBasedTextGUIpublic MultiWindowTextGUI setActiveWindow(Window activeWindow)
WindowBasedTextGUIsetActiveWindow in interface WindowBasedTextGUIactiveWindow - Window to become active and receive input eventspublic Window getActiveWindow()
WindowBasedTextGUIgetActiveWindow in interface WindowBasedTextGUInullpublic BasePane getBackgroundPane()
WindowBasedTextGUIgetBackgroundPane in interface WindowBasedTextGUIBasePane used by this WindowBasedTextGUIpublic WindowPostRenderer getWindowPostRenderer()
WindowBasedTextGUIWindowPostRenderer for this WindowBasedTextGUIgetWindowPostRenderer in interface WindowBasedTextGUIWindowPostRenderer for this WindowBasedTextGUIpublic WindowBasedTextGUI moveToTop(Window window)
WindowBasedTextGUImoveToTop in interface WindowBasedTextGUIwindow - Window in the stack to move to the top positionpublic WindowBasedTextGUI cycleActiveWindow(boolean reverse)
reverse parameter is false
then the current top window is placed at the bottom of the stack and the window immediately behind it is the new
top. If reverse is set to true then the window at the bottom of the stack is moved up to the
front and the previous top window will be immediately below itcycleActiveWindow in interface WindowBasedTextGUIreverse - Direction to cycle through the windowsCopyright © 2020. All rights reserved.