Class GuiComponent

java.lang.Object
de.gurkenlabs.litiengine.gui.GuiComponent
All Implemented Interfaces:
IRenderable, Tweenable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener
Direct Known Subclasses:
DropdownListField, ImageComponent, ImageComponentList, ListField, Screen, Slider

public abstract class GuiComponent
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, IRenderable, Tweenable
The abstract Class GuiComponent provides all properties and methods needed for screens, built-in, and custom GUI components such as buttons, sliders, etc... It includes mouse event handling, different hovering states and appearances, and texts to be rendered.
  • Field Summary

    Fields 
    Modifier and TypeFieldDescription
    protected static java.awt.FontICON_FONT 
  • Constructor Summary

    Constructors 
    ModifierConstructorDescription
    protected GuiComponent​(double x, double y)
    Instantiates a new gui component with the dimension (0,0) at the given location.
    protected GuiComponent​(double x, double y, double width, double height)
    Instantiates a new gui component at the point (x,y) with the dimension (width,height).
  • Method Summary

    Modifier and TypeMethodDescription
    booleandrawTextShadow()
    Draw text shadow.
    AppearancegetAppearance()
    Gets the default appearance object for this GuiComponent.
    AppearancegetAppearanceDisabled()
    Gets the appearance object for this GuiComponent while disabled.
    AppearancegetAppearanceHovered()
    Gets the appearance object for this GuiComponent while hovered.
    java.awt.geom.Rectangle2DgetBoundingBox()
    Gets the bounding box of this GuiComponent.
    protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>>getClickConsumer()
    Gets the click consumer list.
    intgetComponentId()
    Gets the component id of this GuiComponent.
    java.util.List<GuiComponent>getComponents()
    Gets the child components of this GuiComponent.
    protected AppearancegetCurrentAppearance() 
    java.awt.FontgetFont()
    Gets the font of this GuiComponent's text.
    doublegetHeight()
    Gets the height of this GuiComponent.
    protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>>getHoverConsumer()
    Gets the hover consumer list.
    SoundgetHoverSound()
    Gets the sound that is played when hovering the GuiComponent.
    java.awt.geom.Point2DgetLocation()
    Gets the screen location of this GuiComponent.
    protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>>getMouseDraggedConsumer()
    Gets the mouse dragged consumer list.
    protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>>getMouseEnterConsumer()
    Gets the mouse enter consumer list.
    protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>>getMouseLeaveConsumer()
    Gets the mouse leave consumer list.
    protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>>getMouseMovedConsumer()
    Gets the mouse moved consumer list.
    protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>>getMousePressedConsumer()
    Gets the mouse pressed consumer list.
    protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>>getMouseReleasedConsumer()
    Gets the mouse released consumer list.
    protected java.util.List<java.util.function.Consumer<ComponentMouseWheelEvent>>getMouseWheelConsumer()
    Gets the mouse wheel consumer list.
    java.lang.StringgetName()
    Gets the name of this GuiComponent.
    java.awt.geom.RectangularShapegetShape() 
    java.lang.ObjectgetTag()
    Gets the tag.
    java.lang.StringgetText()
    Gets the entire Text associated with this GuiComponent.
    AligngetTextAlign()
    Gets the horizontal text alignment.
    intgetTextAngle()
    Gets the text angle.
    java.awt.ColorgetTextShadowColor()
    Gets the text shadow color.
    floatgetTextShadowStroke()
    Gets the text shadow thickness.
    java.lang.StringgetTextToRender​(java.awt.Graphics2D g)
    Gets only the non-cropped bits of Text visible on this GuiComponent.m To retrieve only the entire text associated with this GuiComponent, use GuiComponent.getText().
    ValigngetTextValign()
    Gets the vertical text alignment.
    doublegetTextX()
    Gets the text X coordinate.
    doublegetTextY()
    Gets the text Y coordinate.
    float[]getTweenValues​(TweenType tweenType)
    Gets one or many values from the target object associated to the given tween type.
    doublegetWidth()
    Gets the width of this GuiComponent.
    doublegetX()
    Gets the x coordinate of this GuiComponent.
    doublegetY()
    Gets the y coordinate of this GuiComponent.
    booleanhasAutomaticLineBreaks() 
    booleanhasTextAntialiasing() 
    protected voidinitializeComponents()
    Initialize child components.
    booleanisEnabled()
    Checks if the GuiComponent is enabled.
    booleanisForwardMouseEvents()
    Checks if mouse events are being forwarded by this GuiComponent.
    booleanisHovered()
    Checks if the cursor bounding box intersects with this GuiComponent's bounding box.
    booleanisPressed()
    Checks if the mouse button is currently being pressed on this GuiComponent.
    booleanisSelected()
    Checks if the GuiComponent is currently selected.
    booleanisSuspended()
    Checks if the GuiComponent is currently suspended.
    booleanisVisible()
    Checks if the GuiComponent is currently visible.
    voidmouseClicked​(java.awt.event.MouseEvent e) 
    voidmouseDragged​(java.awt.event.MouseEvent e) 
    voidmouseEntered​(java.awt.event.MouseEvent e) 
    protected booleanmouseEventShouldBeForwarded​(java.awt.event.MouseEvent e)
    Check if a Mouse event should be forwarded.
    voidmouseExited​(java.awt.event.MouseEvent e) 
    voidmouseMoved​(java.awt.event.MouseEvent e) 
    voidmousePressed​(java.awt.event.MouseEvent e) 
    voidmouseReleased​(java.awt.event.MouseEvent e) 
    voidmouseWheelMoved​(java.awt.event.MouseWheelEvent e) 
    voidonClicked​(java.util.function.Consumer<ComponentMouseEvent> callback)
    Add a callback that is being executed if this GuiComponent is clicked once.
    voidonHovered​(java.util.function.Consumer<ComponentMouseEvent> callback)
    Add a callback that is being executed if this GuiComponent is hovered with the mouse.
    voidonMouseDragged​(java.util.function.Consumer<ComponentMouseEvent> callback)
    Add a callback that is being executed if the mouse is pressed and moving around while within the bounds of this GuiComponent.
    voidonMouseEnter​(java.util.function.Consumer<ComponentMouseEvent> callback)
    Add a callback that is being executed if the mouse enters the bounds of this GuiComponent.
    voidonMouseLeave​(java.util.function.Consumer<ComponentMouseEvent> callback)
    Add a callback that is being executed if the mouse leaves the bounds of this GuiComponent.
    voidonMouseMoved​(java.util.function.Consumer<ComponentMouseEvent> callback)
    Add a callback that is being executed if the mouse is moving around while within the bounds of this GuiComponent.
    voidonMousePressed​(java.util.function.Consumer<ComponentMouseEvent> callback)
    Add a callback that is being executed if the mouse is continually pressed while within the bounds of this GuiComponent.
    voidonMouseReleased​(java.util.function.Consumer<ComponentMouseEvent> callback)
    Add a callback that is being executed if the mouse button is released while within the bounds of this GuiComponent.
    voidonMouseWheelScrolled​(java.util.function.Consumer<ComponentMouseWheelEvent> callback)
    Add a callback that is being executed if the mouse wheel is scrolled while within the bounds of this GuiComponent.
    voidonTextChanged​(java.util.function.Consumer<java.lang.String> cons)
    Add a callback that is being executed if the text on this GuiComponent changes.
    voidprepare()
    Prepare the GuiComponent and all its child Components (Makes the GuiComponent visible and adds mouse listeners.).
    voidrender​(java.awt.Graphics2D g)
    Renders the visual contents of this instance onto the provided graphics context.
    voidsetAutomaticLineBreaks​(boolean automaticLineBreaks) 
    voidsetDimension​(double width, double height)
    Sets the width and height of this GuiComponent.
    voidsetEnabled​(boolean enabled)
    Sets the "enabled" property on this GuiComponent and its child components.
    voidsetFont​(java.awt.Font font)
    Sets the font for this GuiComponent's text.
    voidsetFontSize​(float size)
    Sets the font size for this GuiComponent's text.
    voidsetForwardMouseEvents​(boolean forwardMouseEvents)
    Enable or disable forwarding mouse events by this GuiComponent.
    voidsetHeight​(double height)
    Sets the GuiComponent's height.
    voidsetHovered​(boolean hovered)
    Sets the "enabled" property on this GuiComponent.
    voidsetHoverSound​(Sound hoverSound)
    Sets the hover sound.
    voidsetLocation​(double x, double y)
    Sets this GuiComponent's location.
    voidsetLocation​(java.awt.geom.Point2D location)
    Sets this GuiComponent's location.
    voidsetName​(java.lang.String name)
    Sets this GuiComponent's name.
    voidsetSelected​(boolean bool)
    Sets the "selected" property on this GuiComponent.
    voidsetTag​(java.lang.Object tag)
    Sets the tag.
    voidsetText​(java.lang.String text)
    Sets the text.
    voidsetTextAlign​(Align textAlign)
    Sets the horizontal text alignment.
    voidsetTextAngle​(int textAngle)
    Sets the text angle in degrees.
    voidsetTextAntialiasing​(boolean antialiasing)
    Sets the RenderingHints.KEY_TEXT_ANTIALIASING settings for the rendered text.
    voidsetTextShadow​(boolean drawTextShadow)
    Enable or disable the shadow being drawn below the text
    voidsetTextShadowColor​(java.awt.Color textShadowColor)
    Sets the text shadow color.
    voidsetTextShadowStroke​(float textShadowStroke)
    Sets the text shadow thickness.
    voidsetTextValign​(Valign textValign)
    Sets the vertical text alignment.
    voidsetTextX​(double x)
    Sets the text X coordinate.
    voidsetTextY​(double y)
    Sets the text Y coordinate.
    voidsetTweenValues​(TweenType tweenType, float[] newValues)
    This method is called in a Tween's update() method to set the new interpolated values.
    voidsetVisible​(boolean visible)
    Sets the "visible" property on this GuiComponent.
    voidsetWidth​(double width)
    Sets the GuiComponent's width.
    voidsetX​(double x)
    Sets the GuiComponent's x coordinate.
    voidsetY​(double y)
    Sets the GuiComponent's y coordinate.
    voidsuspend()
    Suspend the GuiComponent and all its child Components (Makes the GuiComponent invisible and removes mouse listeners.).
    voidtoggleSelection()
    Toggle this GuiComponent's selection.
    voidtoggleSuspension()
    Toggle this GuiComponent's suspension state.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ICON_FONT

      protected static final java.awt.Font ICON_FONT
  • Constructor Details

    • GuiComponent

      protected GuiComponent​(double x, double y)
      Instantiates a new gui component with the dimension (0,0) at the given location.
      Parameters:
      x - the x
      y - the y
    • GuiComponent

      protected GuiComponent​(double x, double y, double width, double height)
      Instantiates a new gui component at the point (x,y) with the dimension (width,height).
      Parameters:
      x - the x
      y - the y
      width - the width
      height - the height
  • Method Details

    • drawTextShadow

      public boolean drawTextShadow()
      Draw text shadow.
      Returns:
      true, if successful
    • getAppearance

      public Appearance getAppearance()
      Gets the default appearance object for this GuiComponent.
      Returns:
      the appearance
    • getAppearanceDisabled

      public Appearance getAppearanceDisabled()
      Gets the appearance object for this GuiComponent while disabled.
      Returns:
      the appearance disabled
    • getAppearanceHovered

      public Appearance getAppearanceHovered()
      Gets the appearance object for this GuiComponent while hovered.
      Returns:
      the hovered appearance
    • getBoundingBox

      public java.awt.geom.Rectangle2D getBoundingBox()
      Gets the bounding box of this GuiComponent.
      Returns:
      the bounding box
    • getComponentId

      public int getComponentId()
      Gets the component id of this GuiComponent.
      Returns:
      the component id
    • getComponents

      public java.util.List<GuiComponent> getComponents()
      Gets the child components of this GuiComponent.
      Returns:
      the child components
    • getFont

      public java.awt.Font getFont()
      Gets the font of this GuiComponent's text.
      Returns:
      the GuiComponent's font
    • getHeight

      public double getHeight()
      Gets the height of this GuiComponent.
      Returns:
      the height
    • getHoverSound

      public Sound getHoverSound()
      Gets the sound that is played when hovering the GuiComponent.
      Returns:
      the hover sound
    • getLocation

      public java.awt.geom.Point2D getLocation()
      Gets the screen location of this GuiComponent.
      Returns:
      the screen location
    • getName

      public java.lang.String getName()
      Gets the name of this GuiComponent.
      Returns:
      the name
    • getTag

      public java.lang.Object getTag()
      Gets the tag.
      Returns:
      the tag
    • getText

      public java.lang.String getText()
      Gets the entire Text associated with this GuiComponent. Parts of the Text may get cropped and can therefore be invisible. To retrieve only the visible part of the text, use GuiComponent.getTextToRender(Graphics2D g).
      Returns:
      the entire text on this GuiComponent
    • getTextAlign

      public Align getTextAlign()
      Gets the horizontal text alignment.
      Returns:
      the horizontal text alignment
    • getTextValign

      public Valign getTextValign()
      Gets the vertical text alignment.
      Returns:
      the vertical text alignment
    • getTextAngle

      public int getTextAngle()
      Gets the text angle.
      Returns:
      the text angle
    • hasTextAntialiasing

      public boolean hasTextAntialiasing()
    • hasAutomaticLineBreaks

      public boolean hasAutomaticLineBreaks()
    • getTextShadowColor

      public java.awt.Color getTextShadowColor()
      Gets the text shadow color.
      Returns:
      the text shadow color
    • getTextShadowStroke

      public float getTextShadowStroke()
      Gets the text shadow thickness.
      Returns:
      the float value determining how thick the outline will be rendered.
    • getTextToRender

      public java.lang.String getTextToRender​(java.awt.Graphics2D g)
      Gets only the non-cropped bits of Text visible on this GuiComponent.m To retrieve only the entire text associated with this GuiComponent, use GuiComponent.getText().
      Parameters:
      g - The graphics object to render on.
      Returns:
      the text to render
    • getTextX

      public double getTextX()
      Gets the text X coordinate.
      Returns:
      the text X
    • getTextY

      public double getTextY()
      Gets the text Y coordinate.
      Returns:
      the text Y
    • getWidth

      public double getWidth()
      Gets the width of this GuiComponent.
      Returns:
      the width
    • getX

      public double getX()
      Gets the x coordinate of this GuiComponent.
      Returns:
      the x coordinate
    • getY

      public double getY()
      Gets the y coordinate of this GuiComponent.
      Returns:
      the y coordinate
    • isEnabled

      public boolean isEnabled()
      Checks if the GuiComponent is enabled.
      Returns:
      true, if is enabled
    • isForwardMouseEvents

      public boolean isForwardMouseEvents()
      Checks if mouse events are being forwarded by this GuiComponent.
      Returns:
      true, the GuiComponent forwards mouse events
    • isHovered

      public boolean isHovered()
      Checks if the cursor bounding box intersects with this GuiComponent's bounding box.
      Returns:
      true, if the GuiComponent is hovered
    • isPressed

      public boolean isPressed()
      Checks if the mouse button is currently being pressed on this GuiComponent.
      Returns:
      true, if the mouse is currently pressed on the GuiComponent
    • isSelected

      public boolean isSelected()
      Checks if the GuiComponent is currently selected.
      Returns:
      true, if the GuiComponent is selected
    • isSuspended

      public boolean isSuspended()
      Checks if the GuiComponent is currently suspended.
      Returns:
      true, if the GuiComponent is suspended
    • isVisible

      public boolean isVisible()
      Checks if the GuiComponent is currently visible.
      Returns:
      true, if the GuiComponent is visible
    • mouseClicked

      public void mouseClicked​(java.awt.event.MouseEvent e)
      Specified by:
      mouseClicked in interface java.awt.event.MouseListener
    • mouseDragged

      public void mouseDragged​(java.awt.event.MouseEvent e)
      Specified by:
      mouseDragged in interface java.awt.event.MouseMotionListener
    • mouseEntered

      public void mouseEntered​(java.awt.event.MouseEvent e)
      Specified by:
      mouseEntered in interface java.awt.event.MouseListener
    • mouseExited

      public void mouseExited​(java.awt.event.MouseEvent e)
      Specified by:
      mouseExited in interface java.awt.event.MouseListener
    • mouseMoved

      public void mouseMoved​(java.awt.event.MouseEvent e)
      Specified by:
      mouseMoved in interface java.awt.event.MouseMotionListener
    • mousePressed

      public void mousePressed​(java.awt.event.MouseEvent e)
      Specified by:
      mousePressed in interface java.awt.event.MouseListener
    • mouseReleased

      public void mouseReleased​(java.awt.event.MouseEvent e)
      Specified by:
      mouseReleased in interface java.awt.event.MouseListener
    • mouseWheelMoved

      public void mouseWheelMoved​(java.awt.event.MouseWheelEvent e)
      Specified by:
      mouseWheelMoved in interface java.awt.event.MouseWheelListener
    • onClicked

      public void onClicked​(java.util.function.Consumer<ComponentMouseEvent> callback)
      Add a callback that is being executed if this GuiComponent is clicked once.
      Parameters:
      callback - the callback
    • onHovered

      public void onHovered​(java.util.function.Consumer<ComponentMouseEvent> callback)
      Add a callback that is being executed if this GuiComponent is hovered with the mouse.
      Parameters:
      callback - the callback
    • onMouseDragged

      public void onMouseDragged​(java.util.function.Consumer<ComponentMouseEvent> callback)
      Add a callback that is being executed if the mouse is pressed and moving around while within the bounds of this GuiComponent.
      Parameters:
      callback - the callback
    • onMouseEnter

      public void onMouseEnter​(java.util.function.Consumer<ComponentMouseEvent> callback)
      Add a callback that is being executed if the mouse enters the bounds of this GuiComponent.
      Parameters:
      callback - the callback
    • onMouseLeave

      public void onMouseLeave​(java.util.function.Consumer<ComponentMouseEvent> callback)
      Add a callback that is being executed if the mouse leaves the bounds of this GuiComponent.
      Parameters:
      callback - the callback
    • onMouseMoved

      public void onMouseMoved​(java.util.function.Consumer<ComponentMouseEvent> callback)
      Add a callback that is being executed if the mouse is moving around while within the bounds of this GuiComponent.
      Parameters:
      callback - the callback
    • onMousePressed

      public void onMousePressed​(java.util.function.Consumer<ComponentMouseEvent> callback)
      Add a callback that is being executed if the mouse is continually pressed while within the bounds of this GuiComponent.
      Parameters:
      callback - the callback
    • onMouseReleased

      public void onMouseReleased​(java.util.function.Consumer<ComponentMouseEvent> callback)
      Add a callback that is being executed if the mouse button is released while within the bounds of this GuiComponent.
      Parameters:
      callback - the callback
    • onMouseWheelScrolled

      public void onMouseWheelScrolled​(java.util.function.Consumer<ComponentMouseWheelEvent> callback)
      Add a callback that is being executed if the mouse wheel is scrolled while within the bounds of this GuiComponent.
      Parameters:
      callback - the callback
    • onTextChanged

      public void onTextChanged​(java.util.function.Consumer<java.lang.String> cons)
      Add a callback that is being executed if the text on this GuiComponent changes.
      Parameters:
      cons - the cons
    • prepare

      public void prepare()
      Prepare the GuiComponent and all its child Components (Makes the GuiComponent visible and adds mouse listeners.). This is, for example, done right before switching to a new screen.
    • render

      public void render​(java.awt.Graphics2D g)
      Description copied from interface: IRenderable
      Renders the visual contents of this instance onto the provided graphics context.

      If an Entity implements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.

      This interface can be implemented in general by anything that should be rendered to the game's screen.

      Specified by:
      render in interface IRenderable
      Parameters:
      g - The current graphics object onto which this instance will render its visual contents.
      See Also:
      RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
    • getTweenValues

      public float[] getTweenValues​(TweenType tweenType)
      Description copied from interface: Tweenable
      Gets one or many values from the target object associated to the given tween type. It is used by the Tween Engine to determine starting values.
      Specified by:
      getTweenValues in interface Tweenable
      Parameters:
      tweenType - The tween type of this interpolation, determining which values are modified.
      Returns:
      The array of current tween values.
    • setTweenValues

      public void setTweenValues​(TweenType tweenType, float[] newValues)
      Description copied from interface: Tweenable
      This method is called in a Tween's update() method to set the new interpolated values.
      Specified by:
      setTweenValues in interface Tweenable
      Parameters:
      tweenType - The tween type of this interpolation, determining which values are modified.
      newValues - The new values determined by the tween equation.
    • getShape

      public java.awt.geom.RectangularShape getShape()
    • setDimension

      public void setDimension​(double width, double height)
      Sets the width and height of this GuiComponent.
      Parameters:
      width - the width
      height - the height
    • setEnabled

      public void setEnabled​(boolean enabled)
      Sets the "enabled" property on this GuiComponent and its child components.
      Parameters:
      enabled - the new enabled property
    • setFont

      public void setFont​(java.awt.Font font)
      Sets the font for this GuiComponent's text.
      Parameters:
      font - the new font
    • setFontSize

      public void setFontSize​(float size)
      Sets the font size for this GuiComponent's text.
      Parameters:
      size - the new font size
    • setForwardMouseEvents

      public void setForwardMouseEvents​(boolean forwardMouseEvents)
      Enable or disable forwarding mouse events by this GuiComponent.
      Parameters:
      forwardMouseEvents - the new forward mouse events
    • setHeight

      public void setHeight​(double height)
      Sets the GuiComponent's height.
      Parameters:
      height - the new height
    • setHovered

      public void setHovered​(boolean hovered)
      Sets the "enabled" property on this GuiComponent.
      Parameters:
      hovered - the new hovered
    • setHoverSound

      public void setHoverSound​(Sound hoverSound)
      Sets the hover sound.
      Parameters:
      hoverSound - the new hover sound
    • setLocation

      public void setLocation​(double x, double y)
      Sets this GuiComponent's location.
      Parameters:
      x - the new x coordinate
      y - the new y coordinate
    • setLocation

      public void setLocation​(java.awt.geom.Point2D location)
      Sets this GuiComponent's location.
      Parameters:
      location - the new location
    • setName

      public void setName​(java.lang.String name)
      Sets this GuiComponent's name.
      Parameters:
      name - the new name
    • setSelected

      public void setSelected​(boolean bool)
      Sets the "selected" property on this GuiComponent.
      Parameters:
      bool - the new selected
    • setTag

      public void setTag​(java.lang.Object tag)
      Sets the tag.
      Parameters:
      tag - the new tag
    • setText

      public void setText​(java.lang.String text)
      Sets the text.
      Parameters:
      text - the new text
    • setTextAntialiasing

      public void setTextAntialiasing​(boolean antialiasing)
      Sets the RenderingHints.KEY_TEXT_ANTIALIASING settings for the rendered text.
      Parameters:
      antialiasing - Either RenderingHints.VALUE_TEXT_ANTIALIAS_ON or RenderingHints.VALUE_TEXT_ANTIALIAS_OFF
    • setAutomaticLineBreaks

      public void setAutomaticLineBreaks​(boolean automaticLineBreaks)
    • setTextAlign

      public void setTextAlign​(Align textAlign)
      Sets the horizontal text alignment.
      Parameters:
      textAlign - the new text align
    • setTextValign

      public void setTextValign​(Valign textValign)
      Sets the vertical text alignment.
      Parameters:
      textValign - the new text align
    • setTextAngle

      public void setTextAngle​(int textAngle)
      Sets the text angle in degrees.
      Parameters:
      textAngle - the new text angle in degrees
    • setTextShadow

      public void setTextShadow​(boolean drawTextShadow)
      Enable or disable the shadow being drawn below the text
      Parameters:
      drawTextShadow - the boolean determining if a text shadow should be drawn
    • setTextShadowColor

      public void setTextShadowColor​(java.awt.Color textShadowColor)
      Sets the text shadow color.
      Parameters:
      textShadowColor - the new text shadow color
    • setTextShadowStroke

      public void setTextShadowStroke​(float textShadowStroke)
      Sets the text shadow thickness.
      Parameters:
      textShadowStroke - the thickness of the outline.
    • setTextX

      public void setTextX​(double x)
      Sets the text X coordinate.
      Parameters:
      x - the new text X
    • setTextY

      public void setTextY​(double y)
      Sets the text Y coordinate.
      Parameters:
      y - the new text Y
    • setVisible

      public void setVisible​(boolean visible)
      Sets the "visible" property on this GuiComponent.
      Parameters:
      visible - the new visible
    • setWidth

      public void setWidth​(double width)
      Sets the GuiComponent's width.
      Parameters:
      width - the new width
    • setX

      public void setX​(double x)
      Sets the GuiComponent's x coordinate.
      Parameters:
      x - the new x coordinate
    • setY

      public void setY​(double y)
      Sets the GuiComponent's y coordinate.
      Parameters:
      y - the new y coordinate
    • suspend

      public void suspend()
      Suspend the GuiComponent and all its child Components (Makes the GuiComponent invisible and removes mouse listeners.).
    • toggleSelection

      public void toggleSelection()
      Toggle this GuiComponent's selection.
    • toggleSuspension

      public void toggleSuspension()
      Toggle this GuiComponent's suspension state. If it's suspended, prepare it. If it's prepared, suspend it.
    • getCurrentAppearance

      protected Appearance getCurrentAppearance()
    • getClickConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>> getClickConsumer()
      Gets the click consumer list.
      Returns:
      the click consumer list
    • getHoverConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>> getHoverConsumer()
      Gets the hover consumer list.
      Returns:
      the hover consumer list
    • getMouseDraggedConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>> getMouseDraggedConsumer()
      Gets the mouse dragged consumer list.
      Returns:
      the mouse dragged consumer list
    • getMouseEnterConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>> getMouseEnterConsumer()
      Gets the mouse enter consumer list.
      Returns:
      the mouse enter consumer list
    • getMouseLeaveConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>> getMouseLeaveConsumer()
      Gets the mouse leave consumer list.
      Returns:
      the mouse leave consumer list
    • getMouseMovedConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>> getMouseMovedConsumer()
      Gets the mouse moved consumer list.
      Returns:
      the mouse moved consumer list
    • getMousePressedConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>> getMousePressedConsumer()
      Gets the mouse pressed consumer list.
      Returns:
      the mouse pressed consumer list
    • getMouseReleasedConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseEvent>> getMouseReleasedConsumer()
      Gets the mouse released consumer list.
      Returns:
      the mouse released consumer list
    • getMouseWheelConsumer

      protected java.util.List<java.util.function.Consumer<ComponentMouseWheelEvent>> getMouseWheelConsumer()
      Gets the mouse wheel consumer list.
      Returns:
      the mouse wheel consumer list
    • initializeComponents

      protected void initializeComponents()
      Initialize child components.
    • mouseEventShouldBeForwarded

      protected boolean mouseEventShouldBeForwarded​(java.awt.event.MouseEvent e)
      Check if a Mouse event should be forwarded.
      Parameters:
      e - the mouse event
      Returns:
      true, if the Mouse event should be forwarded