Package megamek.client.ui.swing
Class ChatterBox2
java.lang.Object
megamek.client.ui.swing.ChatterBox2
- All Implemented Interfaces:
KeyListener
,EventListener
,IDisplayable
,IPreferenceChangeListener
public class ChatterBox2
extends Object
implements KeyListener, IDisplayable, IPreferenceChangeListener
A graphical chatterbox within the boardview.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChatterBox2
(ClientGUI client, BoardView boardview, MegaMekController controller) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChatMessage
(String line) Adds a line to the chat, and performs line breaking if necessaryvoid
void
Draws the chatter box.boolean
Returns true when this IDisplayable is being dragged or resized using mouse movement.boolean
Returns true when this IDisplayable is dragged or resized using mouse dragging.boolean
Returns true when the mouse position point is considered "within" this IDisplayable.boolean
isMouseOver
(Point p, Dimension size) Returns true when the mouse position point is considered "within" this IDisplayable.boolean
boolean
Return true while sliding.void
keyPressed
(KeyEvent ke) void
keyReleased
(KeyEvent ke) void
void
void
Scrolls down one line.void
scrollUp()
Scrolls up one line.void
void
setIdleTime
(long timeIdle, boolean add) The boardview calls this to pass on the elapsed time elTime to the IDisplayable.void
setMessage
(String message) boolean
slide()
Conducts a frame update when sliding.void
void
slideUp()
-
Field Details
-
GUIP
-
-
Constructor Details
-
ChatterBox2
-
-
Method Details
-
isReleased
public boolean isReleased()- Specified by:
isReleased
in interfaceIDisplayable
-
isSliding
public boolean isSliding()Description copied from interface:IDisplayable
Return true while sliding. "Sliding" means that this IDisplayable is in the process of opening, closing moving or fading. The boardview will repaint at some fps while an IDisplayable is sliding. The default for this method will always return false.- Specified by:
isSliding
in interfaceIDisplayable
-
slideUp
public void slideUp() -
slideDown
public void slideDown() -
setIdleTime
public void setIdleTime(long timeIdle, boolean add) Description copied from interface:IDisplayable
The boardview calls this to pass on the elapsed time elTime to the IDisplayable. when add is true, elTime is usually the elapsed time since the last call to setIdleTime and should be added to a stored elapsed time. When add is false, elTime should replace the previously stored elapsed time (this is usually used with elTime = 0 to reset the elapsed time). Can be used to make this IDisplayable "slide" after some elapsed time, see slide(). See ChatterBox2 for examples. The default for this method will do nothing.- Specified by:
setIdleTime
in interfaceIDisplayable
-
slide
public boolean slide()Description copied from interface:IDisplayable
Conducts a frame update when sliding. "Sliding" means that this IDisplayable is in the process of opening, closing moving or fading. The boardview will 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:
slide
in interfaceIDisplayable
-
isDragged
Description copied from interface:IDisplayable
Returns true when this IDisplayable is dragged or resized using mouse dragging. This will prevent the boardview from reacting to this mouse action. The default for this method will always return false.- Specified by:
isDragged
in interfaceIDisplayable
-
isBeingDragged
public boolean isBeingDragged()Description copied from interface:IDisplayable
Returns true when this IDisplayable is being dragged or resized using mouse movement. This will prevent the boardview from reacting to this mouse action. The default for this method will always return false.- Specified by:
isBeingDragged
in interfaceIDisplayable
-
isMouseOver
Description copied from interface:IDisplayable
Returns true when the mouse position point is considered "within" this IDisplayable. This is called when the mouse or mouse wheel is moved. backSize is the pixel size of the boardview. The default for this method will always return false.- Specified by:
isMouseOver
in interfaceIDisplayable
-
isHit
Description copied from interface:IDisplayable
Returns true when the mouse position point is considered "within" this IDisplayable. This is called when a mouse button is pressed. The default for this method will always return false.- Specified by:
isHit
in interfaceIDisplayable
-
draw
Draws the chatter box.- Specified by:
draw
in interfaceIDisplayable
-
addChatMessage
Adds a line to the chat, and performs line breaking if necessary- Parameters:
line
-
-
scrollUp
public void scrollUp()Scrolls up one line. -
scrollDown
public void scrollDown()Scrolls down one line. -
keyPressed
- Specified by:
keyPressed
in interfaceKeyListener
-
keyReleased
- Specified by:
keyReleased
in interfaceKeyListener
-
keyTyped
- Specified by:
keyTyped
in interfaceKeyListener
-
getMessage
-
setMessage
-
setChatterBox
-
clearMessage
public void clearMessage() -
preferenceChange
- Specified by:
preferenceChange
in interfaceIPreferenceChangeListener
-