Play a click sound when items are selected using the keyboard
@@ -88,9 +88,6 @@ public boolean onMouseClick(NUIMouseClickEvent event) {
public void onMouseRelease(NUIMouseReleaseEvent event) {
if (event.getMouseButton() == MouseInput.MOUSE_LEFT) {
if (isMouseOver()) {
- if (getClickSound() != null) {
- getClickSound().play(getClickVolume());
- }
activateWidget();
}
down = false;
@@ -195,6 +192,14 @@ public String getMode() {
return DEFAULT_MODE;
}
+ @Override
+ protected void activateWidget() {
+ if (getClickSound() != null) {
+ getClickSound().play(getClickVolume());
+ }
+ super.activateWidget();
+ }
+
/**
* Binds the text to be shown on this {@code UIButton}.
*
