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 Details

  • Constructor Details

  • Method Details

    • isReleased

      public boolean isReleased()
      Specified by:
      isReleased in interface IDisplayable
    • 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 interface IDisplayable
    • 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 interface IDisplayable
    • 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 interface IDisplayable
    • isDragged

      public boolean isDragged(Point p, Dimension size)
      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 interface IDisplayable
    • 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 interface IDisplayable
    • isMouseOver

      public boolean isMouseOver(Point p, Dimension size)
      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 interface IDisplayable
    • isHit

      public boolean isHit(Point p, Dimension size)
      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 interface IDisplayable
    • draw

      public void draw(Graphics graph, Rectangle clipBounds)
      Draws the chatter box.
      Specified by:
      draw in interface IDisplayable
    • addChatMessage

      public void addChatMessage(String line)
      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

      public void keyPressed(KeyEvent ke)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent ke)
      Specified by:
      keyReleased in interface KeyListener
    • keyTyped

      public void keyTyped(KeyEvent ke)
      Specified by:
      keyTyped in interface KeyListener
    • getMessage

      public String getMessage()
    • setMessage

      public void setMessage(String message)
    • setChatterBox

      public void setChatterBox(ChatterBox cb)
    • clearMessage

      public void clearMessage()
    • preferenceChange

      public void preferenceChange(PreferenceChangeEvent e)
      Specified by:
      preferenceChange in interface IPreferenceChangeListener