aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java
index 3b0205e..7111b25 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java
@@ -130,11 +130,23 @@ public final class ObservableProperty<T> implements Supplier<T> {
return this;
}
+ /**
+ * Adds a change listener to this observable property.
+ *
+ * @param listener the added listener
+ */
public void addListener(ChangeListener<? super T> listener) {
+ Objects.requireNonNull(listener);
listeners.add(listener);
}
+ /**
+ * Removes a change listener from this observable property if present.
+ *
+ * @param listener the removed listener
+ */
public void removeListener(ChangeListener<? super T> listener) {
+ Objects.requireNonNull(listener);
listeners.remove(listener);
}