Class BoardToastOverlay
java.lang.Object
megamek.client.ui.clientGUI.boardview.overlay.BoardToastOverlay
- All Implemented Interfaces:
IDisplayable
A board view overlay that displays transient toast notifications. Messages appear at the top-center of the viewport,
optionally showing the acting unit's sprite icon, then fade out after a configurable duration. Multiple messages
stack vertically, each on its own independent timer.
Thread-safe: show(megamek.client.ui.clientGUI.boardview.overlay.ToastLevel, java.lang.String) may be called from any thread. Rendering and animation run on the EDT.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDraw this IDisplayable to the Graphics graph, which is theBoardViewgraphics.booleanReturn true while sliding.voidshow(ToastLevel level, String text) Shows a toast notification with no associated entity icon, using the level's default duration.voidshow(ToastLevel level, String text, Entity entity) Shows a toast notification, optionally displaying the given entity's sprite icon, using the level's default duration.voidshow(ToastLevel level, String text, Entity entity, int durationMs) Shows a toast notification with explicit duration control.booleanslide()Conducts a frame update when sliding.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface megamek.client.ui.IDisplayable
isBeingDragged, isDragged, isHit, isMouseOver, isReleased, setIdleTime
-
Constructor Details
-
BoardToastOverlay
-
-
Method Details
-
show
Shows a toast notification with no associated entity icon, using the level's default duration.- Parameters:
level- the severity level determining color and default durationtext- the message text to display
-
show
Shows a toast notification, optionally displaying the given entity's sprite icon, using the level's default duration.- Parameters:
level- the severity level determining color and default durationtext- the message text to displayentity- the entity whose icon to show, or null for text-only
-
show
Shows a toast notification with explicit duration control.- Parameters:
level- the severity level determining colortext- the message text to displayentity- the entity whose icon to show, or null for text-onlydurationMs- how long the toast remains visible in milliseconds
-
isSliding
public boolean isSliding()Description copied from interface:IDisplayableReturn true while sliding. "Sliding" means that this IDisplayable is in the process of opening, closing moving or fading. TheBoardViewwill repaint at some fps while an IDisplayable is sliding. The default for this method will always return false.- Specified by:
isSlidingin interfaceIDisplayable
-
slide
public boolean slide()Description copied from interface:IDisplayableConducts a frame update when sliding. "Sliding" means that this IDisplayable is in the process of opening, closing moving or fading. TheBoardViewwill repaint at some fps while an IDisplayable is sliding. Return true as long as the slide process is not finished. See ChatterBox2 and KeyBindingsOverlay for examples. The default for this method will always return false.- Specified by:
slidein interfaceIDisplayable
-
draw
Description copied from interface:IDisplayableDraw this IDisplayable to the Graphics graph, which is theBoardViewgraphics. The currently visible part of theBoardViewis given by the Rectangle rect, so the upper left corner of the visibleBoardViewis rect.x, rect.y.- Specified by:
drawin interfaceIDisplayable
-