Class WidgetBuilder<B extends WidgetBuilder<B,T>,T extends AbstractWidget>
java.lang.Object
xyz.gmitch215.socketmc.screen.builder.WidgetBuilder<B,T>
- Type Parameters:
B
- This builder type.T
- The type of widget to build.
- Direct Known Subclasses:
ImageButtonBuilder
,ImageWidgetBuilder
,WidgetWithTextBuilder
public abstract class WidgetBuilder<B extends WidgetBuilder<B,T>,T extends AbstractWidget>
extends Object
Represents a builder for creating an
AbstractWidget
type.-
Method Summary
Modifier and TypeMethodDescriptionbounds
(int x, int y, int width, int height) Sets the bounds of the widget.bounds
(@NotNull ElementBounds bounds) Sets the bounds of the widget.abstract T
build()
Builds the widget.height
(int height) Sets the height of the widget.pos
(int x, int y) Sets the position of the widget.size
(int width, int height) Sets the size of the widget.width
(int width) Sets the width of the widget.x
(int x) Sets the x position of the widget.y
(int y) Sets the y position of the widget.
-
Method Details
-
x
Sets the x position of the widget.- Parameters:
x
- The x position.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if x is negative
-
y
Sets the y position of the widget.- Parameters:
y
- The y position.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if y is negative
-
pos
Sets the position of the widget.- Parameters:
x
- The x position.y
- The y position.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if x or y is negative
-
width
Sets the width of the widget.- Parameters:
width
- The width.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if width is negative
-
height
Sets the height of the widget.- Parameters:
height
- The height.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if height is negative
-
size
Sets the size of the widget.- Parameters:
width
- The width.height
- The height.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if width or height is negative
-
bounds
Sets the bounds of the widget.- Parameters:
x
- The x position.y
- The y position.width
- The width.height
- The height.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if x, y, width, or height is negative
-
bounds
Sets the bounds of the widget.- Parameters:
bounds
- The bounds.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if bounds is null
-
build
Builds the widget.- Returns:
- The built widget.
-