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
Nested ClassesModifier and TypeClassDescriptionprotected static classA utility class to contain various elements inside of a Layout and its settings. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractLayout(int x, int y, int width, int height) Constructs a new AbstractLayout with the specified bounds.protectedAbstractLayout(@NotNull ElementBounds bounds) Constructs a new AbstractLayout with the specified bounds. -
Method Summary
Modifier and TypeMethodDescriptionfinal intGets the height of this object.final intgetWidth()Gets the width of this object.final intgetX()Gets the x-coordinate of this object.final intgetY()Gets the y-coordinate of this object.final booleanGets whether this layout is fullscreen.final voidsetFullscreen(boolean fullscreen) Sets whether this layout is fullscreen.final voidsetHeight(int height) Sets the height of this object.final voidsetWidth(int width) Sets the width of this object.final voidsetX(int x) Sets the x-coordinate of this object.final voidsetY(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, waitMethods inherited from interface xyz.gmitch215.socketmc.screen.layout.Layout
addElement, addElement, addElement, addElement, arrangeElements, createDefaultSettings, visitChildren, visitWidgetsMethods 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:LayoutElementGets the x-coordinate of this object.- Specified by:
getXin interfaceLayoutElement- Returns:
- the x-coordinate
-
setX
public final void setX(int x) Description copied from interface:LayoutElementSets the x-coordinate of this object.- Specified by:
setXin interfaceLayoutElement- Parameters:
x- the x-coordinate
-
getY
public final int getY()Description copied from interface:LayoutElementGets the y-coordinate of this object.- Specified by:
getYin interfaceLayoutElement- Returns:
- the y-coordinate
-
setY
public final void setY(int y) Description copied from interface:LayoutElementSets the y-coordinate of this object.- Specified by:
setYin interfaceLayoutElement- Parameters:
y- the y-coordinate
-
getWidth
public final int getWidth()Description copied from interface:LayoutElementGets the width of this object.- Specified by:
getWidthin interfaceLayoutElement- Returns:
- the width
-
setWidth
public final void setWidth(int width) Description copied from interface:LayoutElementSets the width of this object.- Specified by:
setWidthin interfaceLayoutElement- Parameters:
width- the width
-
getHeight
public final int getHeight()Description copied from interface:LayoutElementGets the height of this object.- Specified by:
getHeightin interfaceLayoutElement- Returns:
- the height
-
setHeight
public final void setHeight(int height) Description copied from interface:LayoutElementSets the height of this object.- Specified by:
setHeightin interfaceLayoutElement- Parameters:
height- the height
-
isFullscreen
public final boolean isFullscreen()Description copied from interface:LayoutGets 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:
isFullscreenin interfaceLayout- Returns:
- true if this layout is fullscreen
-
setFullscreen
public final void setFullscreen(boolean fullscreen) Description copied from interface:LayoutSets 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:
setFullscreenin interfaceLayout- Parameters:
fullscreen- true if this layout is fullscreen
-