Class AbstractLayout

java.lang.Object
xyz.gmitch215.socketmc.screen.layout.AbstractLayout
All Implemented Interfaces:
Serializable, Layout, LayoutElement
Direct Known Subclasses:
EqualSpacingLayout, FrameLayout, GridLayout

public abstract class AbstractLayout extends Object implements Layout

Represents a Screen Layout with basic implementation.

You can extend this class to implement your own custom layout. The Layout must be serializable.

See Also:
  • Field Details

    • x

      protected int x
      The x position of the layout.
    • y

      protected int y
      The y position of the layout.
    • width

      protected int width
      The width of the layout.
    • height

      protected int height
      The height of the layout.
  • Constructor Details

    • AbstractLayout

      protected AbstractLayout(@NotNull @NotNull ElementBounds bounds)
      Constructs a new AbstractLayout with the specified bounds.
      Parameters:
      bounds - the bounds of the layout
    • AbstractLayout

      protected AbstractLayout(int x, int y, int width, int height) throws IllegalArgumentException
      Constructs a new AbstractLayout with the specified bounds.
      Parameters:
      x - the x-coordinate of the layout
      y - the y-coordinate of the layout
      width - the width of the layout
      height - the height of the layout
      Throws:
      IllegalArgumentException - if the size is negative
  • Method Details

    • getX

      public final int getX()
      Description copied from interface: LayoutElement
      Gets the x-coordinate of this object.
      Specified by:
      getX in interface LayoutElement
      Returns:
      the x-coordinate
    • setX

      public final void setX(int x)
      Description copied from interface: LayoutElement
      Sets the x-coordinate of this object.
      Specified by:
      setX in interface LayoutElement
      Parameters:
      x - the x-coordinate
    • getY

      public final int getY()
      Description copied from interface: LayoutElement
      Gets the y-coordinate of this object.
      Specified by:
      getY in interface LayoutElement
      Returns:
      the y-coordinate
    • setY

      public final void setY(int y)
      Description copied from interface: LayoutElement
      Sets the y-coordinate of this object.
      Specified by:
      setY in interface LayoutElement
      Parameters:
      y - the y-coordinate
    • getWidth

      public final int getWidth()
      Description copied from interface: LayoutElement
      Gets the width of this object.
      Specified by:
      getWidth in interface LayoutElement
      Returns:
      the width
    • setWidth

      public final void setWidth(int width)
      Description copied from interface: LayoutElement
      Sets the width of this object.
      Specified by:
      setWidth in interface LayoutElement
      Parameters:
      width - the width
    • getHeight

      public final int getHeight()
      Description copied from interface: LayoutElement
      Gets the height of this object.
      Specified by:
      getHeight in interface LayoutElement
      Returns:
      the height
    • setHeight

      public final void setHeight(int height)
      Description copied from interface: LayoutElement
      Sets the height of this object.
      Specified by:
      setHeight in interface LayoutElement
      Parameters:
      height - the height
    • isFullscreen

      public final boolean isFullscreen()
      Description copied from interface: Layout
      Gets whether this layout is fullscreen. If true, this layout will automatically have its witdh and height set to the screen's width and height.
      Specified by:
      isFullscreen in interface Layout
      Returns:
      true if this layout is fullscreen
    • setFullscreen

      public final void setFullscreen(boolean fullscreen)
      Description copied from interface: Layout
      Sets whether this layout is fullscreen. If true, this layout will automatically have its witdh and height set to the screen's width and height.
      Specified by:
      setFullscreen in interface Layout
      Parameters:
      fullscreen - true if this layout is fullscreen