All Implemented Interfaces:
GUIElement, GUIScrollable, GUIScrollable2, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
GUILabelLog, GUIMessageLog

public abstract class GUILog extends AbstractGUIElement implements GUIScrollable2
Abstract base class for gui elements implementing text fields.
See Also:
  • Constructor Details

    • GUILog

      protected GUILog(@NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull String name, @Nullable @Nullable Image backgroundImage, @NotNull @NotNull Fonts fonts, @NotNull @NotNull GuiFactory guiFactory)
      Creates a new instance.
      Parameters:
      tooltipManager - the tooltip manager to update
      elementListener - the element listener to notify
      name - the name of this element
      backgroundImage - the background image; may be null if unused
      fonts - the Fonts instance for looking up fonts
      guiFactory - the global GUI factory instance
  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: GUIElement
      Releases all allocated resources.
      Specified by:
      dispose in interface GUIElement
      Overrides:
      dispose in class AbstractGUIElement
    • paintComponent

      public void paintComponent(@NotNull @NotNull Graphics g)
      Overrides:
      paintComponent in class JComponent
    • canScroll

      public boolean canScroll(int distance)
      Description copied from interface: GUIScrollable
      Returns whether scrolling is possible.
      Specified by:
      canScroll in interface GUIScrollable
      Parameters:
      distance - the distance to scroll
      Returns:
      whether scrolling is possible
    • scroll

      public void scroll(int distance)
      Description copied from interface: GUIScrollable
      Scrolls the element.
      Specified by:
      scroll in interface GUIScrollable
      Parameters:
      distance - the distance to scroll
    • resetScroll

      public void resetScroll()
      Description copied from interface: GUIScrollable
      Resets the scroll index to the default value.
      Specified by:
      resetScroll in interface GUIScrollable
    • scrollTo

      public void scrollTo(int pos)
      Description copied from interface: GUIScrollable2
      Scrolls to the given location. The possible range is given by a previous notification through a listener registered with GUIScrollable2.addScrollableListener(ScrollableListener).
      Specified by:
      scrollTo in interface GUIScrollable2
      Parameters:
      pos - the location to scroll to
    • addScrollableListener

      public void addScrollableListener(@NotNull @NotNull ScrollableListener listener)
      Description copied from interface: GUIScrollable2
      Adds a scrollable listener to be informed about changes.
      Specified by:
      addScrollableListener in interface GUIScrollable2
      Parameters:
      listener - the listener to add
    • removeScrollableListener

      public void removeScrollableListener(@NotNull @NotNull ScrollableListener listener)
      Description copied from interface: GUIScrollable2
      Removes a scrollable listener.
      Specified by:
      removeScrollableListener in interface GUIScrollable2
      Parameters:
      listener - the listener to remove
    • getBuffer

      @NotNull public @NotNull Buffer getBuffer()
      Returns the Buffer instance containing the text messages.
      Returns:
      the buffer instance
    • setBounds

      public void setBounds(int x, int y, int width, int height)
      Overrides:
      setBounds in class Component
    • mousePressed

      public void mousePressed(@NotNull @NotNull MouseEvent e)
      Description copied from interface: GUIElement
      Will be called when the user has pressed the mouse inside this element.
      Specified by:
      mousePressed in interface GUIElement
      Overrides:
      mousePressed in class AbstractGUIElement
      Parameters:
      e - the mouse event relative to this element
    • mouseReleased

      public void mouseReleased(@NotNull @NotNull MouseEvent e)
      Description copied from interface: GUIElement
      Will be called when the user has released the mouse. This event may be delivered even if no previous GUIElement.mousePressed(MouseEvent) has been delivered before.
      Specified by:
      mouseReleased in interface GUIElement
      Overrides:
      mouseReleased in class AbstractGUIElement
      Parameters:
      e - the mouse event relative to this element
    • mouseDragged

      public void mouseDragged(@NotNull @NotNull MouseEvent e)
      Description copied from interface: GUIElement
      Will be called when the mouse moves within this component while the button is pressed. This event will be delivered after GUIElement.mouseMoved(MouseEvent).

      Note: if the mouse leaves this element's bounding box while the mouse button is still pressed, further mouseDragged (but no mouseMoved) events will be generated.

      Specified by:
      mouseDragged in interface GUIElement
      Overrides:
      mouseDragged in class AbstractGUIElement
      Parameters:
      e - the mouse event relative to this element
    • mouseWheelMoved

      public void mouseWheelMoved(int wheelRotation)
      Description copied from interface: GUIElement
      Will be called when the mouse wheel has been moved.
      Specified by:
      mouseWheelMoved in interface GUIElement
      Overrides:
      mouseWheelMoved in class AbstractGUIElement
      Parameters:
      wheelRotation - the movement amount; negative=away from the user, positive=towards the user
    • setShowSentCommands

      public void setShowSentCommands(boolean showSentCommands)
      Sets whether the commands sent to the server should be shown.
      Parameters:
      showSentCommands - whether to show the commands
    • setShowTimestamps

      public void setShowTimestamps(boolean showTimestamps)
      Sets whether the timestamps are shown.
      Parameters:
      showTimestamps - whether timestamps are shown