aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-07-03 20:31:11 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-07-10 18:37:41 +0300
commitb2d8e33bd9d8aa925aee5e48a9d3784e842f61de (patch)
tree1284ed9f449c753016721109dce8f664f4558f5f /src/main/java
parent3516c394ef0594ecfa1aa71143e5b4dcadfd7c11 (diff)
downloadLibGui-b2d8e33bd9d8aa925aee5e48a9d3784e842f61de.tar.gz
LibGui-b2d8e33bd9d8aa925aee5e48a9d3784e842f61de.tar.bz2
LibGui-b2d8e33bd9d8aa925aee5e48a9d3784e842f61de.zip
Add missing Nullable annotations and a getter to WButton
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java
index 77c76d1..18da1e4 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java
@@ -13,6 +13,8 @@ import net.minecraft.text.StringRenderable;
import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment;
+import javax.annotation.Nullable;
+
public class WButton extends WWidget {
private StringRenderable label;
protected int color = WLabel.DEFAULT_TEXT_COLOR;
@@ -20,8 +22,8 @@ public class WButton extends WWidget {
private boolean enabled = true;
protected HorizontalAlignment alignment = HorizontalAlignment.CENTER;
- private Runnable onClick;
- private Icon icon = null;
+ @Nullable private Runnable onClick;
+ @Nullable private Icon icon = null;
/**
* Constructs a button with no label and no icon.
@@ -132,8 +134,25 @@ public class WButton extends WWidget {
}
}
- public WButton setOnClick(Runnable r) {
- this.onClick = r;
+ /**
+ * Gets the click handler of this button.
+ *
+ * @return the click handler
+ * @since 2.2.0
+ */
+ @Nullable
+ public Runnable getOnClick() {
+ return onClick;
+ }
+
+ /**
+ * Sets the click handler of this button.
+ *
+ * @param onClick the new click handler
+ * @return this button
+ */
+ public WButton setOnClick(@Nullable Runnable onClick) {
+ this.onClick = onClick;
return this;
}
@@ -170,6 +189,7 @@ public class WButton extends WWidget {
* @return the icon
* @since 2.2.0
*/
+ @Nullable
public Icon getIcon() {
return icon;
}
@@ -181,7 +201,7 @@ public class WButton extends WWidget {
* @return this button
* @since 2.2.0
*/
- public WButton setIcon(Icon icon) {
+ public WButton setIcon(@Nullable Icon icon) {
this.icon = icon;
return this;
}