Package app.ui.windows
Class WindowsManager
java.lang.Object
app.ui.windows.WindowsManager
- All Implemented Interfaces:
ICallBack
Class responsible for managing multiple windows.
This class provides a framework for managing a collection of windows in a user interface. It allows for
adding and switching between windows, handling user input, and rendering the currently active window.
-
Constructor Summary
ConstructorsConstructorDescriptionWindowsManager(com.googlecode.lanterna.screen.Screen screen, int x, int y) Constructor for WindowsManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a window to the window manager.voiddraw(int x, int y) Draws the currently active window on the screen.voidkeyStroke(com.googlecode.lanterna.input.KeyStroke keyStroke) Handles a key stroke event for the currently active window.voidonWindowFinished(int chose, String choseString) Called when a window action is completed.voidswitchFrom(int fromIndex, int toIndex, int ms, int directionX, int directionY) Switches from one window to another with a transition effect.
-
Constructor Details
-
WindowsManager
public WindowsManager(com.googlecode.lanterna.screen.Screen screen, int x, int y) Constructor for WindowsManager.- Parameters:
screen- The screen where windows will be managed.x- The X position for window management.y- The Y position for window management.
-
-
Method Details
-
addWindow
Adds a window to the window manager.- Parameters:
window- The window to add.
-
switchFrom
public void switchFrom(int fromIndex, int toIndex, int ms, int directionX, int directionY) Switches from one window to another with a transition effect.- Parameters:
fromIndex- The index of the window to switch from.toIndex- The index of the window to switch to.ms- The duration of the transition in milliseconds.directionX- The X direction of the transition.directionY- The Y direction of the transition.
-
draw
public void draw(int x, int y) Draws the currently active window on the screen.- Parameters:
x- The X position to draw the window at.y- The Y position to draw the window at.
-
keyStroke
public void keyStroke(com.googlecode.lanterna.input.KeyStroke keyStroke) Handles a key stroke event for the currently active window.- Parameters:
keyStroke- The key stroke event to handle.
-
onWindowFinished
Description copied from interface:ICallBackCalled when a window action is completed.- Specified by:
onWindowFinishedin interfaceICallBack- Parameters:
chose- The choice made in the window.choseString- The string representation of the choice.
-