Class AbstractLayout
java.lang.Object
xyz.gmitch215.socketmc.screen.layout.AbstractLayout
- All Implemented Interfaces:
Serializable
,Layout
,LayoutElement
- Direct Known Subclasses:
EqualSpacingLayout
,FrameLayout
,GridLayout
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
A utility class to contain various elements inside of a Layout and its settings. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractLayout
(int x, int y, int width, int height) Constructs a new AbstractLayout with the specified bounds.protected
AbstractLayout
(@NotNull ElementBounds bounds) Constructs a new AbstractLayout with the specified bounds. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Gets the height of this object.final int
getWidth()
Gets the width of this object.final int
getX()
Gets the x-coordinate of this object.final int
getY()
Gets the y-coordinate of this object.final boolean
Gets whether this layout is fullscreen.final void
setFullscreen
(boolean fullscreen) Sets whether this layout is fullscreen.final void
setHeight
(int height) Sets the height of this object.final void
setWidth
(int width) Sets the width of this object.final void
setX
(int x) Sets the x-coordinate of this object.final void
setY
(int y) Sets the y-coordinate of this object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface xyz.gmitch215.socketmc.screen.layout.Layout
addElement, addElement, addElement, addElement, arrangeElements, createDefaultSettings, visitChildren, visitWidgets
Methods inherited from interface xyz.gmitch215.socketmc.screen.layout.LayoutElement
setPosition, setSize, setSize, setSize
-
Field Details
-
x
protected int xThe x position of the layout. -
y
protected int yThe y position of the layout. -
width
protected int widthThe width of the layout. -
height
protected int heightThe height of the layout.
-
-
Constructor Details
-
AbstractLayout
Constructs a new AbstractLayout with the specified bounds.- Parameters:
bounds
- the bounds of the layout
-
AbstractLayout
Constructs a new AbstractLayout with the specified bounds.- Parameters:
x
- the x-coordinate of the layouty
- the y-coordinate of the layoutwidth
- the width of the layoutheight
- 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 interfaceLayoutElement
- 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 interfaceLayoutElement
- 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 interfaceLayoutElement
- 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 interfaceLayoutElement
- 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 interfaceLayoutElement
- 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 interfaceLayoutElement
- Parameters:
width
- the width
-
getHeight
public final int getHeight()Description copied from interface:LayoutElement
Gets the height of this object.- Specified by:
getHeight
in interfaceLayoutElement
- 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 interfaceLayoutElement
- 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 interfaceLayout
- 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 interfaceLayout
- Parameters:
fullscreen
- true if this layout is fullscreen
-