Class FrameLayout
java.lang.Object
xyz.gmitch215.socketmc.screen.layout.AbstractLayout
xyz.gmitch215.socketmc.screen.layout.FrameLayout
- All Implemented Interfaces:
Serializable
,Layout
,LayoutElement
Represents a layout with multiple children, rendered in a frame-like layout.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class xyz.gmitch215.socketmc.screen.layout.AbstractLayout
AbstractLayout.AbstractChildContainer
-
Field Summary
Fields inherited from class xyz.gmitch215.socketmc.screen.layout.AbstractLayout
height, width, x, y
-
Constructor Summary
ConstructorDescriptionCreates a new FrameLayout at the origin with no size.FrameLayout
(int width, int height) Creates a new FrameLayout at the origin with the given size.FrameLayout
(int x, int y, int width, int height) Creates a new FrameLayout with the given position and size.FrameLayout
(@NotNull ElementBounds bounds) Creates a new FrameLayout with the given bounds. -
Method Summary
Modifier and TypeMethodDescription<T extends LayoutElement>
TaddElement
(T element, @NotNull LayoutSettings settings) Adds an element to this layout.void
Arranges the elements inside this Layout.Generates the default layout settings for this layout.Gets an immutable copy of all the children in this layout.int
Gets the minimum height of the layout.int
Gets the minimum width of the layout.setMinHeight
(int minHeight) Sets the minimum height of the layout.setMinSize
(int minWidth, int minHeight) Sets the minimum size of the layout.setMinWidth
(int minWidth) Sets the minimum width of the layout.void
visitChildren
(@NotNull Consumer<LayoutElement> visitor) Visits this layout and all of its children.Methods inherited from class xyz.gmitch215.socketmc.screen.layout.AbstractLayout
getHeight, getWidth, getX, getY, isFullscreen, setFullscreen, setHeight, setWidth, setX, setY
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, visitWidgets
Methods inherited from interface xyz.gmitch215.socketmc.screen.layout.LayoutElement
setPosition, setSize, setSize, setSize
-
Constructor Details
-
FrameLayout
public FrameLayout()Creates a new FrameLayout at the origin with no size. -
FrameLayout
Creates a new FrameLayout with the given bounds.- Parameters:
bounds
- The bounds of the layout.
-
FrameLayout
public FrameLayout(int width, int height) Creates a new FrameLayout at the origin with the given size.- Parameters:
width
- The width of the layout.height
- The height of the layout.
-
FrameLayout
public FrameLayout(int x, int y, int width, int height) Creates a new FrameLayout with the given position and size.- Parameters:
x
- The x position of the layout.y
- The y position of the layout.width
- The width of the layout.height
- The height of the layout.
-
-
Method Details
-
getChildren
Gets an immutable copy of all the children in this layout.- Returns:
- All FrameLayout Children
-
getMinWidth
public int getMinWidth()Gets the minimum width of the layout.- Returns:
- The minimum width of the layout.
-
setMinWidth
Sets the minimum width of the layout.- Parameters:
minWidth
- The minimum width of the layout.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if the minimum width is negative
-
getMinHeight
public int getMinHeight()Gets the minimum height of the layout.- Returns:
- The minimum height of the layout.
-
setMinHeight
Sets the minimum height of the layout.- Parameters:
minHeight
- The minimum height of the layout.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if the minimum height is negative
-
setMinSize
@NotNull public @NotNull FrameLayout setMinSize(int minWidth, int minHeight) throws IllegalArgumentException Sets the minimum size of the layout.- Parameters:
minWidth
- The minimum width of the layout.minHeight
- The minimum height of the layout.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if the minimum width or height is negative
-
addElement
public <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull LayoutSettings settings) throws IllegalArgumentException Description copied from interface:Layout
Adds an element to this layout.- Type Parameters:
T
- the type of the element- Parameters:
element
- the element to addsettings
- the settings for the element- Returns:
- the added element
- Throws:
IllegalArgumentException
- if the element or settings are null
-
createDefaultSettings
Description copied from interface:Layout
Generates the default layout settings for this layout.- Returns:
- Default Layout Settings
-
visitChildren
Description copied from interface:Layout
Visits this layout and all of its children.- Parameters:
visitor
- Element Visitor
-
arrangeElements
public void arrangeElements()Description copied from interface:Layout
Arranges the elements inside this Layout.
-